+ Reply to Thread
Results 1 to 7 of 7

Unhide sheet help

  1. #1
    Registered User
    Join Date
    08-31-2011
    Location
    Utah
    MS-Off Ver
    Excel 2007
    Posts
    3

    Unhide sheet help

    Hello,

    I am trying to set up a code through a button to unhide certain sheets. I am trying to do this with a small amount of code that has good variable ability.

    The set up is a drop down list that will have a number from 1 through 50. The sheets are named Stage 1 through Stage 50. I have it set where you pick the number from the drop down list and it puts the number into the reference cell in the code. You would then click the button and the code would unhide the sheets Stage 1 through Stage "i". (i being the number you picked)

    I have my code here and I haven't done VBA in awhile. Please tell me if I can even do this with vba and what is fundamentally wrong with my code.

    All help would be greatly appreciated.

    Thanks,

    AAA


    Please Login or Register  to view this content.
    Last edited by tswinfor; 09-01-2011 at 01:00 PM.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Unhide sheet help

    Hi tswinfor

    Welcome to the Forum!

    You'll need to add code tags to your code (one of the Forum Rules). Since this is your first post I'd do it for you this time...however...I don't have that ability.

    Rule 3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Select your code and click the [#] button at the top of the post window (if you are editing an existing post, press Go Advanced to see the [#] button).

    Add the tags...perhaps then we can help.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    08-31-2011
    Location
    Utah
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Unhide sheet help

    I tried it but It did not work well. I have other sheets in the workbook that I would not like to hide or unhide. I just want the macro locked to that button so that when that button is clicked it will unhide those stage sheets.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Unhide sheet help

    Hi tswinfor

    Perhaps something like this
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-31-2011
    Location
    Utah
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Unhide sheet help

    All,

    New update for this. John's code did exactly what I wanted to do but I decided to adjust it. I have it right now where I use 2 buttons. One hides all the sheets and then the other shows only the ones you want. I am putting both John's original code and the one I changed to hide the sheet (notice the only difference is the false) so that you can see both. If someone could help me put this into one sub it would be awesome.

    Thanks,

    Tyson

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor yay_excel's Avatar
    Join Date
    08-12-2011
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    190

    Re: Unhide sheet help

    Excel will not allow you to hide all the sheets in a workbook... Your Hide_Sheets code currently hides Stages 1 - 5 only.

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Unhide sheet help

    Hi Tyson

    The code you posted infers something different than your PM message
    I would like it also that for every value greater than the E15 cell that it would hide those sheets.
    This code (which is untested) is designed to do the following:
    All "Stage#" sheets up to the value of E15 will be made visible.
    All "Stage#" sheets from the value of E15 plus 1 to the total sheet count will be hidden.

    That's my understanding of the question you posed in the PM. If my understanding in not correct please let me know.
    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