+ Reply to Thread
Results 1 to 4 of 4

Hiding Multiple Worksheets with VBA

  1. #1
    Registered User
    Join Date
    12-01-2011
    Location
    NY, NY
    MS-Off Ver
    Excel 2007
    Posts
    11

    Hiding Multiple Worksheets with VBA

    Hi there,

    I have a workbook with 16 different worksheets. The first worksheet is what I'm calling a table of contents where I have created ActiveX Control Buttons that I would like to attach VBA Sub procedures to. The sub procedures I'd like to include are, as an example, hide all worksheets except worksheets 1and 2. Then I'd have another button to enact the code that says hide all worksheets except worksheets 4 and 6. I have specific names for each worksheet but hopefully that doesn't matter. I've been trying to figure out why the below doesn't seem to work and could use some help.

    Option Explicit
    Sub Division_1and2 ()
    ' Open the Division 1 and 2 worksheets for data entry.
    '
    Sheets(Array("Division 3", "Division 4", "Division 5", "Division 6", "Division 7", _
    "Division 8", "Division 9", "Division 10", "Division 11", _
    "Division 12", "Division 13", "Division 14", "Division 15")). _
    SelectSheets.Visible = xlSheetHidden
    Sheets("Division 1").Select
    End Sub

    Instead of xlSheetHidden I've also used the term False to no avail.

    Any help would be appreciated.

    Cheers,

    Tom

  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: Hiding Multiple Worksheets with VBA

    Hi Tom

    Please wrap your Code in Code Tags.

    Try this for hiding your selected Sheets
    Please Login or Register  to view this content.
    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
    12-01-2011
    Location
    NY, NY
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Hiding Multiple Worksheets with VBA

    Thank you!!! It worked.

  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: Hiding Multiple Worksheets with VBA

    You're welcome...glad I could help.

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

+ 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. Hiding / Unhiding Columns on Multiple Worksheets
    By TomTom_BV in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-25-2009, 04:55 AM
  2. Hiding worksheets?
    By phil2006 in forum Excel General
    Replies: 2
    Last Post: 07-13-2006, 06:15 AM
  3. hiding worksheets
    By JMB in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 10:05 AM
  4. hiding worksheets
    By frendabrenda1 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 01:05 AM
  5. hiding worksheets
    By Roland in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-21-2005, 10:06 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