+ Reply to Thread
Results 1 to 9 of 9

How to use group and ungroup in a protected worksheet

  1. #1
    Registered User
    Join Date
    01-11-2013
    Location
    tennessee
    MS-Off Ver
    Excel 2010
    Posts
    8

    How to use group and ungroup in a protected worksheet

    Wow...I'm new to VBA programming and need to know how to utilize the group and ungroup features for columns and rows in a protected (2007) worksheet???
    I have tried to paste the program below in a module, save, close, reopen, lock, and the +- toggles still won't work...what am I missing???

    Private Sub workbook_open()
    dim wks as worksheet
    for each wks in thisworkbook.worksheets
    wks.enableoutlining = true
    wks.protect password:="whatever", userinterfaceonly:=true
    next wks
    end sub

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,844

    Re: How to use group and ungroup in a protected worksheet

    Try the following code. Change "password" to your password.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-11-2013
    Location
    tennessee
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How to use group and ungroup in a protected worksheet

    Thanks for trying Mumps1 but that didn'd do it either.

    I have worked on this for hours trying to figure this out...I know it's going to be something I have overlooked.
    Most everything I have read and seen on this subject write just about the same thing you suggested.
    The attached picture is the error I keep getting
    Attached Images Attached Images

  4. #4
    Registered User
    Join Date
    01-11-2013
    Location
    tennessee
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How to use group and ungroup in a protected worksheet

    The picture attached to this thread is a screen shot of VB.......HELP!

    Untitled.jpg

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,844

    Re: How to use group and ungroup in a protected worksheet

    There are only two things that I can suggest. Make sure that the code is in the module for 'ThisWorkbook' and that you save your file and then re-open it.

  6. #6
    Registered User
    Join Date
    01-11-2013
    Location
    tennessee
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How to use group and ungroup in a protected worksheet

    Thanks again but it still doesn't work!!!!! How do I check to see if everything is correct for the to operate???
    When I check the properties in the developer tab EnableOutlining = False.
    I'm thinking there is a security setting or something that isn't set correctly.

    Can someone send me a file that works on your computer to check on mine?????

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,844

    Re: How to use group and ungroup in a protected worksheet

    Hi smorgan. I've used this code in a file and it works for me:

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    01-11-2013
    Location
    tennessee
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: How to use group and ungroup in a protected worksheet

    Hi Mumps1 thank you so much for all your help.
    You are correct!!! It works well when written in the correct location.
    I was trying to write it in a module. When I wrote it in ThisWorkbook it worked very well!!!
    I knew it was something I was doing wrong. Thanks again

  9. #9
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,844

    Re: How to use group and ungroup in a protected worksheet

    I'm glad it worked out for you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1