+ Reply to Thread
Results 1 to 5 of 5

Toggle Switch to hide/show column groups.

  1. #1
    Registered User
    Join Date
    05-13-2014
    MS-Off Ver
    Excel 2010
    Posts
    10

    Toggle Switch to hide/show column groups.

    Hello, I was trying to create a button to hide or show columns that I have grouped, but for some reason I cannot do this using the record function. Is there another way to do this? Also, I already have a "Reset" button on the same spreadsheet that clears the filters, is this why I am having the issue? Would it be better to use a toggle switch instead or option buttons? Is there a way to have my "Reset" button also effect the column filters to default back to an unhidden appearance? This will eventually be a protected document that many will use.

    Thank You in Advance for all of your help.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Toggle Switch to hide/show column groups.

    With this sample data, grouped by quarters (Q1, Q2, etc) and by Year:
    Data Range
    A
    B
    C
    D
    E
    F
    G
    H
    I
    J
    K
    L
    M
    N
    O
    P
    Q
    R
    1
    Name
    Jan
    Feb
    Mar
    Q1
    Apr
    May
    Jun
    Q2
    Jul
    Aug
    Sep
    Q3
    Oct
    Nov
    Dec
    Q4
    Year
    2
    Alpha
    1
    1
    1
    3
    2
    2
    2
    6
    3
    3
    3
    9
    4
    4
    4
    12
    30
    3
    Bravo
    1
    1
    1
    3
    2
    2
    2
    6
    3
    3
    3
    9
    4
    4
    4
    12
    30
    4
    Charlie
    1
    1
    1
    3
    2
    2
    2
    6
    3
    3
    3
    9
    4
    4
    4
    12
    30
    This VBA code sets the worksheet outline level to 2 (so all quarters are collapsed) then expands Q1 (so Jan, Feb and Mar display)
    Please Login or Register  to view this content.
    Is that something you can work with?
    Last edited by Ron Coderre; 06-22-2015 at 01:07 PM.

  3. #3
    Registered User
    Join Date
    05-13-2014
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Toggle Switch to hide/show column groups.

    Mr. Coderre,

    Thank You for your quick response. I think my initial thread was a little confusing on what I was trying to do. I went ahead an attached the spreadsheet. I'm trying to use the Hide / Show option buttons to hide/show the columns that I have set as groups. Then I wanted to include the "show" as the default to the reset button. (Not sure if that is possible, but figured I would ask.

    I appreciate all of your help.

    Thanks,
    Mike

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Toggle Switch to hide/show column groups.

    using your posted workbook....

    Put this VBA code in your module:
    Please Login or Register  to view this content.
    That code toggles the display/hide of the grouped columns.

    Assign both option buttons to that macro.

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  5. #5
    Registered User
    Join Date
    05-13-2014
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Toggle Switch to hide/show column groups.

    Worked perfectly, thank you

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Hide Show Excel Toolbars using a Toggle Button
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 07-11-2012, 05:11 PM
  2. VBA hide row based on pull down with button to toggle show/hide
    By myronr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-12-2012, 06:07 PM
  3. [SOLVED] Toggle text Show/Hide Macro
    By theghost in forum Excel General
    Replies: 2
    Last Post: 04-12-2012, 02:41 PM
  4. Toggle Hide/ Show Named Ranges
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-11-2012, 06:33 PM
  5. [SOLVED] Can value at A1 toggle hide/show of row 2?
    By kj in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-16-2005, 12:29 AM

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