+ Reply to Thread
Results 1 to 5 of 5

Problem with Hidden Worksheet

  1. #1
    Shatin
    Guest

    Problem with Hidden Worksheet

    I have a macro which depends on getting the name of a worksheet:

    Worksheets(sht & i).Select

    where sht is a string and i an integer.

    This macro runs fine when the worksheet selected is visible. However, should
    I change the visible status to "xlSheetHidden", the worksheet doesn't work
    anymore. Is there anyway to make the macro work even when the worksheet is
    hidden?

    TIA.



  2. #2
    Vasant Nanavati
    Guest

    Re: Problem with Hidden Worksheet

    You can't select a hidden worksheet, but you can work with it. Just forget
    about the Select stuff and do whatever you need to do; e.g.:

    Worksheets(sht & i).Range("A1").Copy

    --

    Vasant


    "Shatin" <[email protected]> wrote in message
    news:[email protected]...
    >I have a macro which depends on getting the name of a worksheet:
    >
    > Worksheets(sht & i).Select
    >
    > where sht is a string and i an integer.
    >
    > This macro runs fine when the worksheet selected is visible. However,
    > should
    > I change the visible status to "xlSheetHidden", the worksheet doesn't work
    > anymore. Is there anyway to make the macro work even when the worksheet is
    > hidden?
    >
    > TIA.
    >
    >




  3. #3
    Shatin
    Guest

    Re: Problem with Hidden Worksheet

    Thanks for reply, Vasant. The problem is the macro is a long one with a few
    QueryTables. So I am a bit at a loss as to what to do if I can't select the
    worksheet first and instead have to add Worksheets(sht & i) all over the
    place.

    "Vasant Nanavati" <vasantn AT aol DOT com> wrote in message
    news:[email protected]...
    > You can't select a hidden worksheet, but you can work with it. Just forget
    > about the Select stuff and do whatever you need to do; e.g.:
    >
    > Worksheets(sht & i).Range("A1").Copy
    >
    > --
    >
    > Vasant
    >
    >
    > "Shatin" <[email protected]> wrote in message
    > news:[email protected]...
    > >I have a macro which depends on getting the name of a worksheet:
    > >
    > > Worksheets(sht & i).Select
    > >
    > > where sht is a string and i an integer.
    > >
    > > This macro runs fine when the worksheet selected is visible. However,
    > > should
    > > I change the visible status to "xlSheetHidden", the worksheet doesn't

    work
    > > anymore. Is there anyway to make the macro work even when the worksheet

    is
    > > hidden?
    > >
    > > TIA.
    > >
    > >

    >
    >




  4. #4
    Registered User
    Join Date
    08-24-2005
    Location
    Philippines
    Posts
    75
    Hi Shatin! Some things can't be done to a hidden sheet (e.g. selecting). If you really have to manipulate the hidden sheet, maybe you can unhide it, then hide it again after.

    TheHiddenSheet.Visible = xlSheetVisible

    'do your stuff here...

    TheHiddenSheet.Visible = xlSheetHidden



    Quote Originally Posted by Shatin
    Thanks for reply, Vasant. The problem is the macro is a long one with a few
    QueryTables. So I am a bit at a loss as to what to do if I can't select the
    worksheet first and instead have to add Worksheets(sht & i) all over the
    place.

    "Vasant Nanavati" <vasantn AT aol DOT com> wrote in message
    news:[email protected]...
    > You can't select a hidden worksheet, but you can work with it. Just forget
    > about the Select stuff and do whatever you need to do; e.g.:
    >
    > Worksheets(sht & i).Range("A1").Copy
    >
    > --
    >
    > Vasant
    >
    >
    > "Shatin" <[email protected]> wrote in message
    > news:[email protected]...
    > >I have a macro which depends on getting the name of a worksheet:
    > >
    > > Worksheets(sht & i).Select
    > >
    > > where sht is a string and i an integer.
    > >
    > > This macro runs fine when the worksheet selected is visible. However,
    > > should
    > > I change the visible status to "xlSheetHidden", the worksheet doesn't

    work
    > > anymore. Is there anyway to make the macro work even when the worksheet

    is
    > > hidden?
    > >
    > > TIA.
    > >
    > >

    >
    >

  5. #5
    William Benson
    Guest

    Re: Problem with Hidden Worksheet

    Right-O ... and with Application.ScreenUpdating set to false, who's the
    wiser ;-)


    "T-容x" <[email protected]> wrote in message
    news:[email protected]...
    >
    > Hi Shatin! Some things can't be done to a hidden sheet (e.g. selecting).
    > If you really have to manipulate the hidden sheet, maybe you can
    > unhide it, then hide it again after.
    >
    > TheHiddenSheet.Visible = xlSheetVisible
    >
    > 'do your stuff here...
    >
    > TheHiddenSheet.Visible = xlSheetHidden
    >
    >
    >
    > Shatin Wrote:
    >> Thanks for reply, Vasant. The problem is the macro is a long one with a
    >> few
    >> QueryTables. So I am a bit at a loss as to what to do if I can't select
    >> the
    >> worksheet first and instead have to add Worksheets(sht & i) all over
    >> the
    >> place.
    >>
    >> "Vasant Nanavati" <vasantn AT aol DOT com> wrote in message
    >> news:[email protected]...
    >> > You can't select a hidden worksheet, but you can work with it. Just

    >> forget
    >> > about the Select stuff and do whatever you need to do; e.g.:
    >> >
    >> > Worksheets(sht & i).Range("A1").Copy
    >> >
    >> > --
    >> >
    >> > Vasant
    >> >
    >> >
    >> > "Shatin" <[email protected]> wrote in message
    >> > news:[email protected]...
    >> > >I have a macro which depends on getting the name of a worksheet:
    >> > >
    >> > > Worksheets(sht & i).Select
    >> > >
    >> > > where sht is a string and i an integer.
    >> > >
    >> > > This macro runs fine when the worksheet selected is visible.

    >> However,
    >> > > should
    >> > > I change the visible status to "xlSheetHidden", the worksheet

    >> doesn't
    >> work
    >> > > anymore. Is there anyway to make the macro work even when the

    >> worksheet
    >> is
    >> > > hidden?
    >> > >
    >> > > TIA.
    >> > >
    >> > >
    >> >
    >> >

    >
    >
    > --
    > T-容x
    > ------------------------------------------------------------------------
    > T-容x's Profile:
    > http://www.excelforum.com/member.php...o&userid=26572
    > View this thread: http://www.excelforum.com/showthread...hreadid=401655
    >




+ 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