Hi - I am trying to enable group / ungroup in a few sheets that are protected. I do want the users to be able to name the sheets themselves so I cannot hard code the sheet names. I tried this vba to test out and the functionality seems to work.
So my question is - how would I change the code so that I can include say all protected sheets or perhaps from / to sheet. Or said differently - I would like the code to be more dynamic than having to define the names of each tab as the names might change
So my question is - how would I change the code so that I can include say all protected sheets or perhaps from / to sheet. Or said differently - I would like the code to be more dynamic than having to define the names of each tab as the names might change
<< Use CODE -tags >>
Code:
Private Sub Workbook_Open()
For Each wks In ThisWorkbook.Worksheets(Array( _
"BBUS"))
With wks
.Unprotect "pw"
.EnableOutlining = True
.Protect "pw", contents:=True, userInterfaceOnly:=True
End With
Next
End Sub
Last edited by a moderator: