+ Reply to Thread
Results 1 to 4 of 4

Unhide or hide sheets based on drop down list value - need help combining these two macros

  1. #1
    Registered User
    Join Date
    08-23-2012
    Location
    Charotte,NC
    MS-Off Ver
    Excel 2007
    Posts
    25

    Unhide or hide sheets based on drop down list value - need help combining these two macros

    I'm trying to incorporate these these macros into one where the drop down value would unhide any sheet name starting with that value. I'd also like for it to be an Open Workbook event so that when the workbook is reopened the selected values will stay in place. This is important because there is another macro forcing a user to enable macros that unhides all sheets when the workbook opens.

    Macro1

    Please Login or Register  to view this content.
    The above needs to be combined with the below:


    Please Login or Register  to view this content.
    Thanks for any help.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Unhide or hide sheets based on drop down list value - need help combining these two ma

    Welcome to the Forum!

    First, do you need help writing the code for Macro 1? You have shown code that doesn't actually work because the Range values just look like descriptions of what you want to do, rather than actual range values. For example, I would suggest this:
    Please Login or Register  to view this content.
    As far as the rest, it is not at all clear what you want to happen when the workbook is opened, what it means when you say "selected values will stay in place", whether you need some kind of help with your second macro, or what you mean by combining the two macros.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    08-23-2012
    Location
    Charotte,NC
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Unhide or hide sheets based on drop down list value - need help combining these two ma

    Thanks for your reply. What I menat by "selected values" was whatever sheet(s) was selected from the drop down would remain hidden when the workbook was reopened. A macro forcing a user to enable macros unhides all sheets when opening as well as saving a file, including the ones that need to both hidden and very hidden. I have written the sheets that need to remain hidden/very hidden back into code but it would be more convenient to do this at the sheet level.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Unhide or hide sheets based on drop down list value - need help combining these two ma

    The first post said that the sheet selected from the dropdown becomes visible, here you say when the file opens you want them to remain hidden. Can you clarify which one you need? My code makes the selected sheets visible.

    I would have one Sub that sets the visibility of sheets as shown in the code I provided above. Then the same code would be called by Worksheet_Change and Workbook_Open. Workbook_BeforeClose would hide all sheets.

    This goes into a new Module:
    Please Login or Register  to view this content.
    This goes into the Worksheet module:
    Please Login or Register  to view this content.
    This goes into the Workbook module:
    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