+ Reply to Thread
Results 1 to 7 of 7

Way to hide or unhide sheets based on selection criteria

  1. #1
    Registered User
    Join Date
    05-02-2005
    Posts
    65

    Way to hide or unhide sheets based on selection criteria

    I have a spreadsheet that is used to quote the growing list of products and services that we sell. It has grown to over 50+ sheets and is getting difficult to navigate, especially those not very comfortable with Excel. Is there a way to have a user defined list of a subset of the total sheets available to select from and those not selected would be automatically hidden. Based on this type of usage, there might only be 5 to 8 sheets needs for the typical user.

    I do not know VBA and am a beginner with macros, but I would appreciate your thoughts!

    Thanks,
    Jim

  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: Way to hide or unhide sheets based on selection criteria

    Truth is you could have ALL the sheets hidden except for a single FRONT sheet with an organized list of all the sheetnames in the workbook. A simple macro could watch for whatever cell the user clicks on, and if the cell happens to hold a text string that matches a hidden sheet, poof, the sheet is unhidden and the user taken there.

    On every hidden sheet would be a HOME button, too, so a single click in the same spot on every sheet poofs the user back to the navigation sheet, hiding the sheet they were on as they transfer home.

    Pretty simple, two macros would do it. One macro in the sheet module of your HOME sheet;
    Please Login or Register  to view this content.

    And the other in the ThisWorkbook module:
    Please Login or Register  to view this content.
    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 Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Way to hide or unhide sheets based on selection criteria

    This link may give you some ideas.

    http://www.excelforum.com/excel-prog...-criteria.html

  4. #4
    Registered User
    Join Date
    05-02-2005
    Posts
    65

    Re: Way to hide or unhide sheets based on selection criteria

    Thank you JBeaucaire for your response. I am very excited about the possibilities of your example. I have uploaded a file that
    shows what I am thinking. I wanted to provide a home screen that lists a subset of the totally available sheets and, once selected,
    those sheets would be unbidden and all others would then be hidden. Is that possible?

    Thanks again for your time and suggestions!
    Jim
    Attached Files Attached Files

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

    Re: Way to hide or unhide sheets based on selection criteria

    These little macros could help:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    05-02-2005
    Posts
    65

    Re: Way to hide or unhide sheets based on selection criteria

    Thanks you again JBeaucaire. Your example create three scenarios: (1)UnHideall, (2)hideall, and (3)UnHidesome. The first two work fine. The third one really is what the sample spreadsheet I uploaded with teh select boxes. When I try to run that one, it give me an error message that says "Subscript Out of Range" and I must admit that I am a complete beginner with VBA & Macros. I did make one change to you sample code:

    Please Login or Register  to view this content.

    As you will notice, the one change that I made to your sample was I changed "Sheet1" to "Sheet48" since "Sheet48" is the sheet that contains the user selection area that would include the "x" (i.e. the spreadsheet I uploaded on the previous post). I hope that makes sense. What are your thoughts?

    Also, once I get through this issues, I would like to have a button that the sales rep using this (usually not excel literate at all) would hit to run this rather than having to hit Alt - F11 and then run.

    Thanks you again for your time and consideration in this!
    Jim
    Last edited by JBeaucaire; 10-21-2016 at 07:27 PM. Reason: fixed the [/CODE] tag.

  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: Way to hide or unhide sheets based on selection criteria

    Subscript out of Range - this error usually means the name of some object is wrong in some manner. So something about "Sheet48" is wrong. Maybe there's a hidden space on the sheet tab.

+ 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. Unhide and hide a range of Rows based on a selection
    By caliskier in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-30-2015, 11:48 PM
  2. Hide / Unhide Shapes Based on Cell Selection
    By ckoolsurf in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-05-2015, 05:33 PM
  3. VBA Hide/Unhide individual sheets based on selection in drop down menu
    By igullage in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-05-2015, 08:01 PM
  4. Auto hide/unhide sheets based on selection
    By Gifted Ed in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2014, 12:25 AM
  5. Unhide & Hide sheets based on combobox1 selection VBA help needed
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-29-2013, 11:20 AM
  6. Hide/Unhide sheets based on combo box selection
    By prabs_message in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-21-2013, 01:43 AM
  7. [SOLVED] How to hide & unhide rows based on selection from drop down box?
    By jgomez in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-02-2013, 08:30 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