+ Reply to Thread
Results 1 to 5 of 5

Hiding and Unhiding Sheets based on a list

  1. #1
    Registered User
    Join Date
    08-27-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2007
    Posts
    12

    Hiding and Unhiding Sheets based on a list

    Hello, I am using the following code to look at the active worksheet, find the last row and then create a list (shList) of all of the sheets I want to hide/unhide. It works perfectly for more than one sheet in the range.. but if there is only one sheet, it doesn't hide/unhide. Any ideas on how to get it work whether the range is one sheet or multiple sheets?

    Please Login or Register  to view this content.
    Last edited by alansidman; 08-15-2019 at 03:29 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs
    MS-Off Ver
    MS Office 365
    Posts
    19,403

    Re: Hiding and Unhiding Sheets based on a list

    Code Tags Added
    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)

  3. #3
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    391

    Re: Hiding and Unhiding Sheets based on a list

    The shList variable transposing the range in column Q is not needed. When there is only one item in the list, I'm guessing that the variant is no longer an array, which is required for the Match function. Try this - it should work:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    08-27-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Hiding and Unhiding Sheets based on a list

    Works like a charm! Thanks so much!

  5. #5
    Registered User
    Join Date
    08-27-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Hiding and Unhiding Sheets based on a list

    Sorry.. I saw that but had no idea how to do it. I see the # button now. Thanks for correcting for me.

+ 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] Codes for Prevent users from adding sheets, deleting sheets, hiding/unhiding sheets
    By geniusufo007 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-13-2017, 11:57 PM
  2. Hiding/Unhiding Multiple Sheets
    By excel_126 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-07-2015, 02:50 AM
  3. Hiding/unhiding sheets
    By nkburm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-27-2010, 04:07 PM
  4. Hiding/unhiding sheets
    By nkburm in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-27-2010, 03:49 PM
  5. Hiding/Unhiding columns based on a dropdown list
    By jim_0068 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-12-2007, 11:57 AM
  6. [SOLVED] Hiding and Unhiding Sheets
    By Rob in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-13-2006, 10:40 AM
  7. Hiding and unhiding sheets
    By D.Hay in forum Excel General
    Replies: 2
    Last Post: 12-10-2005, 12:00 PM

Tags for this Thread

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