I'm a novice to macros and previously found help on this site to write a macro that will allow grouped rows and columns to be expanded and collapsed
on 2 protected worksheets in my workbook while retaining the protection parameters that I originally selected.
This is the macro I ended up using:
Private Sub Workbook_Open()
With Worksheets(“Tab1”)
.Unprotect "password"
.EnableOutlining = True
.Protect "password", DrawingObjects:=True, contents:=True, Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, userInterfaceOnly:=True
End With
With Worksheets(“Tab2”)
.Unprotect "password"
.EnableOutlining = True
.Protect "password", DrawingObjects:=True, contents:=True, Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, userInterfaceOnly:=True
End With
End Sub
I want to add Edit Objects to the list of protection parameters that remains checked so I tried adding
AllowEditingObjects:=True, to the code, but I now get a debug error message when I open the workbook.
Is it possible to add that parameter to the list and, if so, can someone provide the proper code to do so?
Thank you!