Codurile VBA de mai jos as vrea sa le utilizez pentru Protect/Unprotect toate sheeturile unui workbook.
Nu stiu unde gresesc. Codurile functioneaza doar in sheetul activ.
Rog ajutor. Multumesc.
Cod: Selectaţi tot
Sub ProtectAllSheets()
Dim sh As Worksheet
On Error Resume Next
For Each sh In ActiveWorkbook.Sheets
ActiveSheet.Unprotect ""
Application.CutCopyMode = False
ActiveSheet.Protect "", DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlNoSelection
Next sh
End Sub
Cod: Selectaţi tot
Sub UnprotectAllSheets()
Dim sh As Worksheet
On Error Resume Next
For Each sh In ActiveWorkbook.Sheets
ActiveSheet.Unprotect ""
Application.CutCopyMode = True
ActiveSheet.Protect "", DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingRows:=True
ActiveSheet.EnableSelection = xlUnlockedCells
Next sh
End Sub