elainaExcel
New Member
- Joined
- Jul 9, 2019
- Messages
- 2
I need a macro to run upon opening excel that allows groups to expand and collapse while a sheet is protected. I am using the code below and it works, the issue is that when it re-protects my sheet is it only doing the first two defaulted lock preferences, "Allow all users of this worksheet to: select locked cells, select unlocked cells" I need the first five options "Allow all users of this worksheet to: select locked cells, select unlocked cells, format cells, format columns, format rows".
Please help! This is my first adventure into macros so exact code is very helpful.
[FONT="]Sub Autpen()
[/FONT]
[FONT="]Application.ScreenUpdating = False
[/FONT]
[FONT="]For Each ws In Sheets
[/FONT]
[FONT="]With ws
.Unprotect Password:=""
.Protect Password:="", UserInterfaceOnly:=True
.EnableOutlining = True
End With[/FONT]
[FONT="]Next ws[/FONT]
[FONT="]Application.ScreenUpdating = True[/FONT]
[FONT="]End Sub[/FONT]
Please help! This is my first adventure into macros so exact code is very helpful.
[FONT="]Sub Autpen()
[/FONT]
[FONT="]Application.ScreenUpdating = False
[/FONT]
[FONT="]For Each ws In Sheets
[/FONT]
[FONT="]With ws
.Unprotect Password:=""
.Protect Password:="", UserInterfaceOnly:=True
.EnableOutlining = True
End With[/FONT]
[FONT="]Next ws[/FONT]
[FONT="]Application.ScreenUpdating = True[/FONT]
[FONT="]End Sub[/FONT]