+ Reply to Thread
Results 1 to 4 of 4

Code to select worksheets based on sheet names in a list

  1. #1
    Registered User
    Join Date
    11-21-2011
    Location
    Birmingham, AL
    MS-Off Ver
    Excel 2013
    Posts
    5

    Code to select worksheets based on sheet names in a list

    Hi all,

    First post, I hope I'm clear enough.

    I'm working on a macro which hides/unhides worksheets after a user runs the "build" macros in the workbook (which create a number of new tabs named with values in a list). I'm hoping to find code that will select all the sheets which were built during the previous process. The sheet names in the build process are in a list on a "maintenance" tab so I'm assuming the easiest way to accomplish this is to somehow select the sheets to hide/unhide based on that same list. The problem I'm encountering is that VBA needs to know either the sheet name or the codename, but both of these will change each time the user runs the building macro. Help would be much appreciated!! Thanks!!

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,626

    Re: Code to select worksheets based on sheet names in a list

    Don't you have a list on the sheet names on the maintenance tab?

    If you do you can loop through it and hide all the sheets on the list.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    11-21-2011
    Location
    Birmingham, AL
    MS-Off Ver
    Excel 2013
    Posts
    5

    Re: Code to select worksheets based on sheet names in a list

    Ugh. Yes. I knew there was going to be some simple solution that I missed. Thank you!!

    Will this still work using the "visible = not visible" "Next" syntax?

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,626

    Re: Code to select worksheets based on sheet names in a list

    Don't think I've ever heard of that syntax.

    I was thinking something like this.
    Please Login or Register  to view this content.
    Where 'Maintenance' is the maintenance sheet and A2:A15 is the range on that sheet with the list of sheets to hide, both of which can be changed.

+ 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] Code that finds and deletes names from current sheet to all worksheets in workbook
    By grazian2 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-01-2013, 11:51 AM
  2. How to list names of all worksheets in my summary sheet And how to template a sheet?
    By liajet24 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-25-2013, 07:10 PM
  3. Copy cells from multiple worksheets into one list with Sheet names.
    By ksamarin88 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-11-2012, 04:45 PM
  4. Replies: 2
    Last Post: 02-06-2012, 07:39 PM
  5. Creating New Worksheets based on a list of names
    By kchm_2000 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2011, 06:40 AM

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