+ Reply to Thread
Results 1 to 4 of 4

Macro to Create Check boxes for tabs to hide and unhide them as well as allow you to group

Hybrid View

  1. #1
    Registered User
    Join Date
    02-19-2015
    Location
    Hastings, MN
    MS-Off Ver
    2013
    Posts
    12

    Macro to Create Check boxes for tabs to hide and unhide them as well as allow you to group

    As stated, I haven't found this somewhere yet. I was wondering if someone had a macro that would create a checkbox for every tab in the worksheet, allow you to group those tabs, so one check box would check uncheck multiple at once or allow you to click the individual check box which would then allow you to hide and unhide them. Does anyone have this?

    So if I wanted to look at this set of worksheets in a workbook, then hide some of them but maybe keep the summary page open and then work on another section by unhiding that group of tabs? Does this make sense. A macro to auto create a Table of Content of checkboxes as well as allow you to group them into sections.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,384

    Re: Macro to Create Check boxes for tabs to hide and unhide them as well as allow you to g

    Hi TehXII7 and welcome to the forum,

    Doing all your requests using check boxes takes too much programming overhead. Here is another possible way that may be better for you. In the attached are lists of sheet numbers you can hide or unhide by simply adding or removing numbers from the lists. I've given the lists NAMED RANGED that are DYNAMIC so you can add or remove numbers from them. I've also included some code to make the buttons work.

    See if this example gets you closer to your goal. BTW - there are only 15 tabs in this example.

    Code looks like this:
    Sub HideTabs()
        Dim TabNo As Double
        Dim LastTab As Double
        LastTab = Range("Hide_TabsDNR").Count
        On Error Resume Next
        For TabNo = 2 To LastTab
            Sheets(Range("Hide_TabsDNR")(TabNo)).Visible = False
        Next TabNo
        On Error GoTo 0
        Sheets(1).Select
    End Sub
    
    Sub UnHideTabs()
        Dim TabNo As Double
        Dim LastTab As Double
        LastTab = Range("Hide_TabsDNR").Count
        On Error Resume Next
        For TabNo = 2 To LastTab
            Sheets(Range("UnHide_TabsDNR")(TabNo)).Visible = True
        Next TabNo
        On Error GoTo 0
        Sheets(1).Select
    End Sub
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    02-19-2015
    Location
    Hastings, MN
    MS-Off Ver
    2013
    Posts
    12

    Re: Macro to Create Check boxes for tabs to hide and unhide them as well as allow you to g

    I actually had most of this capability where I previously worked. Essentially you input the names of the tabs in a column and then the tabs were created based off of a template.

    So how about this... I take the list of all the tabs I have and put them in a column. If there is something preset a checkbox is created after I say hit a macro button. The could we somehow had an if statement to decide if it would be a subsection of that check box or not?

    I apologize, I am fairly new to coding VBA. This would be an extremely useful tool for what I am doing. Thanks.

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,384

    Re: Macro to Create Check boxes for tabs to hide and unhide them as well as allow you to g

    So the bottom line is - VBA trying to use check boxes is way too hard for what most of us want to do. Instead of having a check box it is much easier to put an "x" in a cell next to what you want to include. As soon as you add check boxes then you need to tell which cell they associate too and the VBA and programming problems get hard fast.

    See the attached where I've used double click in Column A instead of trying to code Check Boxes. I hope this makes sense. Combine this with some code to hide or unhide your tabs.
    Attached Files Attached Files

+ 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. Using check boxes to hide and unhide worksheets
    By J_barber in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-12-2017, 04:27 AM
  2. Apply a hide/unhide macro to all selected tabs
    By eric_be in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-22-2014, 08:50 AM
  3. Hide or Unhide worksheets in a workbook using check boxes
    By Kempfat in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-14-2012, 05:35 AM
  4. [SOLVED] Check Box Macro to hide and unhide a column
    By Daphne in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-26-2006, 08:55 AM
  5. Check boxes to show/hide Tabs
    By Sridhar Rao in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-05-2005, 12:06 PM

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