+ Reply to Thread
Results 1 to 6 of 6

Excel 2007 : Toggle Button

  1. #1
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Toggle Button

    I have set up a Toggle Button that controls the 'Show Detail' and 'Hide Detail' Level 1 and Level 2 Group/Ungroup option in Excel (see attached sample), using the following code.

    Please Login or Register  to view this content.
    My question is this.

    Is there a way to adapt this code to control individual ranges of grouped columns? For example, if I have columns 2 to 6 grouped and then columns 10 to 15 as a second group, is there a way to add a second toggle button so that each button controls a different grouping?
    Attached Files Attached Files

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441

    Re: Toggle Button

    something like this to collapse/expand individual groupings

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Toggle Button

    Hi Andy

    Thanks for your reply (and sorry for the delay in mine - been trying to sort other issues).

    My lack of VBA knowledge is showing. Tried your code but I get errors. I have left Button 1 showing and hiding all levels, but I want Button 2 to just show and hide a single set of grouped cells.

    Button 1 Code
    Please Login or Register  to view this content.


    Button 2 Code

    Please Login or Register  to view this content.

    I have attached the spreadsheet sample. Not being familiar with the terminology and functionality of VBA I am just tweaking relatively randomly without understanding the errors.

    Are you able to point me in the right direction, again... Many thanks.
    Attached Files Attached Files

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441

    Re: Toggle Button

    This worked for me

    Please Login or Register  to view this content.

  5. #5
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,441

    Re: Toggle Button

    Actually try this code instead.

    Please Login or Register  to view this content.
    It was error previously depending on the state of the columns set by the other togglebutton.

  6. #6
    Forum Contributor
    Join Date
    06-21-2010
    Location
    -
    MS-Off Ver
    Excel 2010
    Posts
    1,211

    Re: Toggle Button

    Andy

    Many thanks once again, that works perfectly...

+ 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