+ Reply to Thread
Results 1 to 3 of 3

Show / Hide Sheets based off a cell input

  1. #1
    Registered User
    Join Date
    10-15-2012
    Location
    Cary
    MS-Off Ver
    Excel 2003
    Posts
    18

    Show / Hide Sheets based off a cell input

    I've seen several ways to hide sheets based off a determined value. The way I have been doing it is like the following:

    Please Login or Register  to view this content.
    This is clearly cumbersome and could be polished up with a loop. I am not skilled enough ... yet ... to put this code together. Can someone give me a hand in doing this? The spark for this thread came from my code being too long when trying to introduce 40 sheets and the code not executing at all.

    Thanks in advance

    Evan
    Last edited by Cutter; 10-16-2012 at 02:09 PM. Reason: Added code tags

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Show / Hide Sheets based off a cell input

    Please Login or Register  to view this content.
    Last edited by patel45; 10-16-2012 at 03:27 AM.
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    10-15-2012
    Location
    Cary
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Show / Hide Sheets based off a cell input

    Thanks patel45. It perfoms the function as intended, but it keeps giving me a "Run-time error '9': subscript out of range" message. The debugger goes to this lines: "Sheets(sheetname).Visible = False". Is this something on my end with the master spreadsheet or is this code related?

    I think part of it may be that I have two spreadsheets titled "master" and "index". The code that states "for i=j to ThisWorkbook.Sheets.Count" would return a count 2 + higher than the CofA sheets that I want to hide.

    I made a minor alteration to the code to account for these two pages. The completed code is below:
    Please Login or Register  to view this content.
    Again, thanks Patel45.
    Last edited by evancharles; 10-16-2012 at 09:37 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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