+ Reply to Thread
Results 1 to 4 of 4

Selecting Hidden Sheets

Hybrid View

  1. #1
    Registered User
    Join Date
    06-09-2009
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007
    Posts
    17

    Selecting Hidden Sheets

    I have the following code which works fine when all of the sheets are not hidden:

    Sub CurrencyEuro()
    Dim i As Integer
    Application.ScreenUpdating = False
    
    For i = 8 To 43
        Sheets(i).Select
        Range("A502").Select
        ActiveWindow.ScrollRow = 498
        Next i
    
    ...
    However, depending on other factors another macro sometimes hides some of the sheets from 8-43. Then the code doesn't work. How can I still run this macro when some of the sheets are hidden?

    Preferably I don't want to use the names of the worksheets, because those are dynamic.
    Last edited by dej222; 09-02-2009 at 08:00 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Selecting Hidden Sheets

    Delete those three lines of code. It's almost never necessary to Select anything to operate with or on it.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    06-09-2009
    Location
    Chicago, IL
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Selecting Hidden Sheets

    I just made all of the sheets visible, then ran the macro above, then called the macro that was hiding some of the sheets.

    Works fine now.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Selecting Hidden Sheets

    But still better (faster, shorter) to not select at all.

+ 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