Use group/ungroup with a locked workbook

naveed

New member
Joined
Jul 1, 2015
Messages
5
Reaction score
0
Points
0
Hi friends,

I want to use the group/ungroup option while my sheet is locked with a password.
I have tried to use the following code but doesn't work.
Need your help, also if i can use the filters with a locked sheet that would be awesome :).

Private Sub Workbook_Open()
With Worksheets("Emp Summary")
.EnableOutlining = True
.Protect UserInterfaceOnly:=True
End With
End Sub


Thanks
 
Works here in Excel 2010.
You do have a sheet called Emp Summary?
 
group/ungroup in protected sheet

Works here in Excel 2010.
You do have a sheet called Emp Summary?

Hi there

I pasted the same code in VB editor, saved the file as ".xlsm", then protected the sheet with a password. Didn't work for me,
what's wrong that i am doing here?? Also i need to enable the user to use auto filter feature in the sheet.

My sheet is named as "Sheet1"


Private Sub Workbook_Open()
With Worksheets("Sheet1")
.EnableOutlining = True
.Protect UserInterfaceOnly:=True
End With
End Sub
 
It doesn't need to be protected manually first, but if it is then supply the password in the code:
.Protect Password:="mysecretpassword", UserInterfaceonly:=true
Obviously, adjust the password itself in the code to suit what you've used.
 
Back
Top