Forum Discussion
Using Group-Ungroup in a protected Excel sheet
You have to create the grouping/outline while the worksheet is unprotected.
You have to protect the sheet in a special way when the workbook is opened.
Activate the Visual Basic Editor (Option+F11).
Double-click ThisWorkbook under Microsoft Excel Objects in the Project Explorer pane on the left.
Copy this code into the ThisWorkbook module:
Private Sub Workbook_Open()
With Me.Worksheets("Sheet1")
.Protect Password:="Secret", UserInterfaceOnly:=True
.EnableOutlining = True
End With
End Sub
Replace Sheet1 with the name of the relevant sheet, and replace Secret with the password that you used to protect the sheet (use "" if you didn't specify a password).
Save the workbook as a macro-enabled workbook (*.xlsm).
Make sure that you allow macros when you open the workbook.
This doesn't seem to work in the online version of Excel, but the version desktop it does. Any help with the online version of Execl? I need group / ungroup disabled for one sheet.