+ Reply to Thread
Results 1 to 5 of 5

Add the name of each visible worksheet to an array.

  1. #1
    Forum Contributor
    Join Date
    04-11-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    325

    Add the name of each visible worksheet to an array.

    I am attempting to read each worksheet that is visible into an array but can't get the syntax. If anyone can show me the proper syntax or even find a more efficient method than I am using and will show me I'd appreciate it.

    Please Login or Register  to view this content.
    Everything is declared properly. I just don't know how to test if a worksheet is visible or not.

    I have tried

    If ws.Visible
    If ws.Visible = True
    If ws = xlSheetVisible


    Thanks in advance for any help.
    Last edited by 111StepsAhead; 06-15-2011 at 08:11 AM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Add the name of each visible worksheet to an array.

    Visbility has three options.

    xlSheetVisible
    xlSheetHidden
    xlSheetVeryHidden

    The final one can only be unhidden by code.

    Syntax like...

    Please Login or Register  to view this content.
    Martin

  3. #3
    Forum Contributor
    Join Date
    04-11-2011
    Location
    Columbus, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    325

    Re: Add the name of each visible worksheet to an array.

    The options you showed me also did not work. I appreciate the effort though.

    The sheets will either be xlSheetVisible or xlSheetVeryHidden. So to add to the list of what doesn't work...

    If ws.Visible = xlSheetVisible
    If ws.Visible <> xlSheetVeryHidden

    In all cases I am simply increasing iCount by 1 or trying to. Each time it counts to 16 (the number of sheets I have.)

  4. #4
    Forum Contributor
    Join Date
    04-01-2009
    Location
    Irvine, CA
    MS-Off Ver
    Excel 2010
    Posts
    280

    Re: Add the name of each visible worksheet to an array.

    How about this code?

    Please Login or Register  to view this content.

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Add the name of each visible worksheet to an array.

    or
    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