+ Reply to Thread
Results 1 to 4 of 4

VBA to hide group of specific tabs

  1. #1
    Registered User
    Join Date
    04-02-2011
    Location
    Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    38

    VBA to hide group of specific tabs

    Hi,

    Can someone help me with this?

    I'm trying to write some code that will hide all tabs in a workbook that have tab names that end with "U" or "C", and leave all other tabs visible.

    I know how to write a macro to hide all tabs except tabs with a "known" tab name, but for this application I need a wildcard character for the first ( name length - 1 ) characters, or something.


    There can be anywhere from 100 tabs to many hundred that I need to hide, and all are almost always named in the form:

    001U
    ...
    030C

    ...etc.

    Occasionally if the numbers extend beyond 999C or 999U there will be 5 character tab names: 1020U, etc.

    The purpose of this is to easily pull out the dozen or so tabs that do not end in "U" or "C", so the code I'm trying to write doesn't necessarily have to just hide tabs. If someone knows how to read all the tab names from a workbook and write them to cells in a column on a sheet in that workbook, that would spectacular...


    Thanks!

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: VBA to hide group of specific tabs

    Hi Deucejmp,

    The following code hides all worksheets ending in U or C (lower case as well).
    Please Login or Register  to view this content.
    Hope that helps!

  3. #3
    Registered User
    Join Date
    04-02-2011
    Location
    Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: VBA to hide group of specific tabs

    Thanks--that works great!

    How about code to write all the tab names in the workbook to column A in sheet "Src"? (one cell each--A1 first tab, A2 second tab, until all tabs are processed)

    Is that possible?

  4. #4
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,885

    Re: VBA to hide group of specific tabs

    Yes it is, see below.
    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