+ Reply to Thread
Results 1 to 8 of 8

Using a macro to move to next sheet

  1. #1
    Registered User
    Join Date
    02-12-2007
    Posts
    88

    Angry Using a macro to move to next sheet

    Is there a way to move from one sheet to the next by using a macro or any other method??

    I know you can simply write:

    sheets("Sheet1").select

    This is all well and good until I delete this page or insert one in front of it. If the tab is deleted the macro will crash. If a sheet is inserted in front of it, this macro will skip the new sheet.

    I just want to move to the next sheet in the workbook... I've been stumped by this for ages now.

    Any help is appreciated.

    Thanks

  2. #2
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,
    Please Login or Register  to view this content.
    HTH
    Carim


    Top Excel Links

  3. #3
    Registered User
    Join Date
    02-12-2007
    Posts
    88
    Quote Originally Posted by Carim
    Hi,
    Please Login or Register  to view this content.

    Thank you very much. That worked great!!

    However, if it is the last page it crashes. Do you know a way to stop the code from working if it is the last sheet in the workbook??

  4. #4
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Glad it fixed your problem ...
    Please Login or Register  to view this content.
    Thanks for the feedback

  5. #5
    Registered User
    Join Date
    02-12-2007
    Posts
    88
    Thanks for all the help, however. . .

    I have a new requirement. If I am on the last sheet instead of selecting the same sheet again, is there a way that I can get back to the 1st sheet in the workbook?


  6. #6
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    02-12-2007
    Posts
    88
    Thanks again.

    How did you get so knowledgeable???

  8. #8
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Glad it fixed your problem ...

    Thanks for the feedback


    P.S. Knowledge is always relative ... and directly function of ...practice ...

+ 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