Results 1 to 4 of 4

Thread: Use group/ungroup with a locked workbook

  1. #1

    Use group/ungroup with a locked workbook



    Register for a FREE account, and/
    or Log in to avoid these ads!

    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

  2. #2
    Super Moderator p45cal's Avatar
    Join Date
    Dec 2012
    Posts
    1,551
    Articles
    0
    Excel Version
    365
    Works here in Excel 2010.
    You do have a sheet called Emp Summary?

  3. #3

    group/ungroup in protected sheet

    Quote Originally Posted by p45cal View Post
    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

  4. #4
    Super Moderator p45cal's Avatar
    Join Date
    Dec 2012
    Posts
    1,551
    Articles
    0
    Excel Version
    365
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •