Forum Discussion
Protect 'summary' sheet from editing but enable grouping - is it possible?
- Feb 18, 2019
As far as I'm aware you need to use VBA to do this using Sheet.EnableOutlining = True
Right Click on your summary tab and select View Code
Then paste this code in the window
Private Sub Worksheet_Activate() With ActiveSheet .Protect Password:="XYZ", UserInterfaceOnly:=True .EnableOutlining = True End With End Sub
This code could be put in a workbook open event or wherever is suitable.
As far as I'm aware you need to use VBA to do this using Sheet.EnableOutlining = True
Right Click on your summary tab and select View Code
Then paste this code in the window
Private Sub Worksheet_Activate() With ActiveSheet .Protect Password:="XYZ", UserInterfaceOnly:=True .EnableOutlining = True End With End Sub
This code could be put in a workbook open event or wherever is suitable.
- JulieG1974Feb 19, 2019Copper Contributor
Firstly, thanks so much for the answer given. it helped in part.
- I couldnt understand why it was working one minute, but not the next. then found out I needed to save as an xlsm file instead of xslx
Having done this, I now find when I go back to the document after closing, the changes are not saved. If I 'view code' I see the changes are still there, but 'enable outlining' has reverted back to false.... So now, I can no longer expand the rows because they are protected. To do this, I have to 'view code' and save every time I want to open the document again.
What am i doing wrong please!?!??
- Wyn HopkinsFeb 19, 2019MVPHi
The code is set to run each time the worksheet is “activated”. So when you click on a different sheet then click back on the summary it will trigger the macro to run and set enable outline to false
Other options would be to assign the macro to a button that you click on the summary page or to put the code to trigger when the workbook opens ( relies on people clicking the “enable macros” warning when they open the file)