WaelTalaat
New Member
- Joined
- Feb 19, 2022
- Messages
- 1
- Office Version
- 2016
- Platform
- Windows
Hi, I have a Macro code to enable the row grouping as below and i saved it as enable macro excel
but unfortunately when i re-open the excel file the file showed as protected and to unprotect only the grouping i have to re-run the macro manually
so do you have any idea how to keep the macro running after reopen to protect the cells and keep only the grouping row worked
the code i used is :
Sub allowGroup()
Dim mySheet As Worksheet
Set mySheet = Application.ActiveSheet
Dim myPW As String
myPW = Application.InputBox("Type one Password to protect your worksheet:", "allowGroup", "", Type:=2)
mySheet.Protect Password:=myPW, Userinterfaceonly:=True
mySheet.EnableOutlining = True
End Sub
but unfortunately when i re-open the excel file the file showed as protected and to unprotect only the grouping i have to re-run the macro manually
so do you have any idea how to keep the macro running after reopen to protect the cells and keep only the grouping row worked
the code i used is :
Sub allowGroup()
Dim mySheet As Worksheet
Set mySheet = Application.ActiveSheet
Dim myPW As String
myPW = Application.InputBox("Type one Password to protect your worksheet:", "allowGroup", "", Type:=2)
mySheet.Protect Password:=myPW, Userinterfaceonly:=True
mySheet.EnableOutlining = True
End Sub