+ Reply to Thread
Results 1 to 7 of 7

Use checkbox to show/hide sheets?

  1. #1
    Registered User
    Join Date
    03-25-2009
    Location
    Sweden
    MS-Off Ver
    Excel 2003
    Posts
    49

    Use checkbox to show/hide sheets?

    Hey

    Im having a small problem that im trying to solve in some way. I only have some knownledge in basic macros and not in VBA, and since i cant figure out a way to solve my problem.

    Is it possible to do this.

    I have a workbook (i attach a testfile). Right now i have 4 sheets in it. The "Main Sheet" is called "Pre"

    Here i have 3 checkboxes.

    I also have 3 "hidden" sheets called "sheet1", "sheet2" and "sheet3".

    What im trying to do is when i "mark" the checkbox called "sheet1" then i want the hidden "sheet1" to show up. And same goes with all the sheets.

    So basicly when i click "sheet1" checkbox that sheet will get unhidden.
    Attached Files Attached Files
    Last edited by Zheno; 11-03-2010 at 02:23 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Use checkbox to show/hide sheets?

    It's a little easier to use the Control Box Check boxes for this instead of the forms. after adding the boxes and changing the captions, I put this code in:

    Please Login or Register  to view this content.

    As you can see, it lets you hide/unhide sheets based on what you've put in the check box captions, so you don't have to keep editing the code if you change the sheet names, just change the captions and it will keep working.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Use checkbox to show/hide sheets?

    If you stick with Form Controls then repeat this for each checkbox
    Please Login or Register  to view this content.

    I would use ActiveX controls as Jerry shows
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  4. #4
    Registered User
    Join Date
    03-25-2009
    Location
    Sweden
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Use checkbox to show/hide sheets?

    Thanks a ton both of you for the help, exactly what i need.

    Another question in the same matter, is it possible to open 2 or more sheets with the same checkbox?
    Last edited by Zheno; 11-03-2010 at 01:56 PM.

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Use checkbox to show/hide sheets?

    Just add as many as you need to open
    Please Login or Register  to view this content.

    With Jerrys' code you will probably need to change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    If you want to avoid complications

    Hope this helps.

  6. #6
    Registered User
    Join Date
    03-25-2009
    Location
    Sweden
    MS-Off Ver
    Excel 2003
    Posts
    49

    Re: Use checkbox to show/hide sheets?

    Quote Originally Posted by Marcol View Post
    Just add as many as you need to open
    Please Login or Register  to view this content.

    With Jerrys' code you will probably need to change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    If you want to avoid complications

    Hope this helps.
    Working perfect, thanks a ton once again. Marking as solved.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Use checkbox to show/hide sheets?

    A fun option to not have to use IF/THEN :

    Please Login or Register  to view this content.

+ 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