Forum Discussion
Mick_Kitcher
May 06, 2023Copper Contributor
Using Group-Ungroup in a protected Excel sheet
what do i need t do to enable me to group and ungroup rows in my spreadsheet without having to unprotect it? Any help most welcome, thank you.
HansVogelaar
May 07, 2023MVP
I have attached a very simple demo workbook. Does it work for you if you allow macros when you open it?
Mick_Kitcher
May 07, 2023Copper Contributor
Hi Hans, yes it does, i already have macros enabled, it works great, i will recheck my sheet to ensure i have not got some cells locked or something, i don't think i have but whatever it is the problem must be at my end. i will let you know and thank you once again for your help.
- Err404Sep 27, 2023Copper Contributor
Mick_Kitcher once you have added the code provided above you need to exit out of Excel then reopen it for the changed to take effect because the new code is run when the file is opened
- GeoCash2Jan 01, 2024Copper Contributor
Your code works great except I wanted the user to be able to add a row. When I attempt to turn that function on within a group it would not allow if after a reopening of the workbook. Err404
- HansVogelaarJan 01, 2024MVP
Change the line
.Protect Password:="Secret", UserInterfaceOnly:=Truein the Workbook_Open event procedure to
.Protect Password:="Secret", UserInterfaceOnly:=True, AllowInsertingRows:=True