+ Reply to Thread
Results 1 to 4 of 4

skip hidden sheets

  1. #1
    savalou
    Guest

    skip hidden sheets

    I have a workbook with about 50 sheets. I have a decision tree that
    unhides sheets based on the answers to screening questions. I want to
    add navigation buttons to allow users to go to the next or previous
    sheets. When the next sheet is hidden the macro hangs. How can move
    to the next unhidden sheet?

    I've tried:

    activesheet.next.select

    which didn't work.

    Any thoughts?

    thanks in advance,

    Dave


  2. #2
    Tom Ogilvy
    Guest

    Re: skip hidden sheets


    Dim sh as Object
    if Activesheet.Index <> Sheets.count then
    set sh = activesheet.Next

    do while sh.visible <> xlSheetVisible and sh.Index <> sheets.count
    set sh = sh.Next
    Loop
    if sh.visible = xlSheetVisible then
    sh.Activate
    else
    msgbox "Nothing to do"
    end if

    --
    Regards,
    Tom Ogilvy


    "savalou" <david.boone@acgov.org> wrote in message
    news:1129663834.198941.68500@f14g2000cwb.googlegroups.com...
    > I have a workbook with about 50 sheets. I have a decision tree that
    > unhides sheets based on the answers to screening questions. I want to
    > add navigation buttons to allow users to go to the next or previous
    > sheets. When the next sheet is hidden the macro hangs. How can move
    > to the next unhidden sheet?
    >
    > I've tried:
    >
    > activesheet.next.select
    >
    > which didn't work.
    >
    > Any thoughts?
    >
    > thanks in advance,
    >
    > Dave
    >




  3. #3
    Tom Ogilvy
    Guest

    Re: skip hidden sheets

    Left off the last end if

    Dim sh as Object
    if Activesheet.Index <> Sheets.count then
    set sh = activesheet.Next

    do while sh.visible <> xlSheetVisible and sh.Index <> sheets.count
    set sh = sh.Next
    Loop
    if sh.visible = xlSheetVisible then
    sh.Activate
    else
    msgbox "Nothing to do"
    end if
    Else
    msgbox "Your at the last"
    End if

    --
    Regards,
    Tom Ogilvy

    "Tom Ogilvy" <twogilvy@msn.com> wrote in message
    news:OOxxWxB1FHA.3084@TK2MSFTNGP09.phx.gbl...
    >
    > Dim sh as Object
    > if Activesheet.Index <> Sheets.count then
    > set sh = activesheet.Next
    >
    > do while sh.visible <> xlSheetVisible and sh.Index <> sheets.count
    > set sh = sh.Next
    > Loop
    > if sh.visible = xlSheetVisible then
    > sh.Activate
    > else
    > msgbox "Nothing to do"
    > end if
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "savalou" <david.boone@acgov.org> wrote in message
    > news:1129663834.198941.68500@f14g2000cwb.googlegroups.com...
    > > I have a workbook with about 50 sheets. I have a decision tree that
    > > unhides sheets based on the answers to screening questions. I want to
    > > add navigation buttons to allow users to go to the next or previous
    > > sheets. When the next sheet is hidden the macro hangs. How can move
    > > to the next unhidden sheet?
    > >
    > > I've tried:
    > >
    > > activesheet.next.select
    > >
    > > which didn't work.
    > >
    > > Any thoughts?
    > >
    > > thanks in advance,
    > >
    > > Dave
    > >

    >
    >




  4. #4
    savalou
    Guest

    Re: skip hidden sheets

    that's great. Thanks very much.

    Dave


+ 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