Notifications
Clear all

Bloqueio de planilha

4 Posts
2 Usuários
0 Reactions
836 Visualizações
(@vonzuben)
Posts: 549
Prominent Member
Topic starter
 

Fiz o bloqueio da planilha e deixei desbloqueado as celulas onde vou editar, mas quando clica na celula para editar pede senha.

Não quero que fica pedindo senha

No VBA está assim

ActiveSheet.Unprotect
ActiveSheet.Protect

Tentei isso o código abaixo, mas não deu

ActiveSheet.Protect Password:="123", UserInterfaceOnly:=True

Obrigado desde já !

 
Postado : 22/10/2016 7:30 am
(@vonzuben)
Posts: 549
Prominent Member
Topic starter
 

Acho que deu certo

ActiveSheet.Unprotect Password:="123"

 
Postado : 22/10/2016 9:08 am
(@miguel-70)
Posts: 0
New Member
 

Tem esta sugestão que vai facilitar. Coloque este código click 'ALT F11' e cole na planilha desejada para bloquear;

Private Sub Worksheet_Change(ByVal Target As Range) 'Código não bloqueia formula somente texto
Dim rng As Range
ActiveSheet.Unprotect Password:="12"
Cells.Locked = False
On Error Resume Next
Set rng = Cells.SpecialCells(XlCellTypeText)
Set rng = Cells.SpecialCells(xlCellTypeFormulas)
If Err.Number > 0 Then
Set rng = Cells.SpecialCells(xlCellTypeConstants)
Set rng = Union(rng, Cells.SpecialCells(XlCellTypeText))
Set rng = Union(rng, Cells.SpecialCells(xlCellTypeFormulas))
Else
End If
On Error GoTo 0
If Not rng Is Nothing Then rng.Locked = True
ActiveSheet.Protect Password:="12"
'ActiveWorkbook.Save
End
End Sub

 
Postado : 22/10/2016 9:25 am
(@miguel-70)
Posts: 0
New Member
 

Bloqueia texto e formulas

 
Postado : 22/10/2016 9:32 am