Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Select Next Sheet

  1. #1
    New Member
    Join Date
    Feb 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I want to have my macro select the next sheet in a spreadsheet. I have tried recording the macro with relative references, but it still gives the tab name in the code. (??)

    I am doing this within a loop and just want excel do what it needs to on the first sheet, go to the next sheet and start again/loop until finished (about 35 times). How can I get it to go to the next sheet without having to name it??

    I apologize if this is a dumb/simple question, but this is Macro stuff is pretty new to me and any advice would be greatly appreciated!! Thanks!

  2. #2
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-02-18 18:05, 88MUST50 wrote:
    I want to have my macro select the next sheet in a spreadsheet. I have tried recording the macro with relative references, but it still gives the tab name in the code. (??)

    I am doing this within a loop and just want excel do what it needs to on the first sheet, go to the next sheet and start again/loop until finished (about 35 times). How can I get it to go to the next sheet without having to name it??

    I apologize if this is a dumb/simple question, but this is Macro stuff is pretty new to me and any advice would be greatly appreciated!! Thanks!
    Number of ways to do this;

    Dim sh As Worksheet

    For Each sh In ActiveWorkbook.Sheets
    sh.Activate

    'do your stuff

    Next sh



    HTH

    Ivan

  3. #3
    New Member
    Join Date
    Feb 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks Ivan!

    Unfortunately, I have tried that but would not work for me because of the way I am pulling the data. For example, I am pulling every fifth column from spreadsheet A and placing into spreadsheet B, with every fifth column from A being a new tab in B.

    My macro currently goes to spreadsheet A, selects column 1, copies to spreadsheet B sheet1 (which it later renames). I then need spreadsheet B to go to the next tab to accept the information from column 5 on spreadsheet A.

    When I apply this formula, I am limited to the spreadsheet that I am in. I don't think I can alternate back and forth or can I??

    Please forgive me if this does not make sense! Thanks!!

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •