+ Reply to Thread
Results 1 to 3 of 3

How do make a macro activate the next sheet?

Hybrid View

  1. #1
    Registered User
    Join Date
    12-21-2005
    Posts
    12

    Question How do make a macro activate the next sheet?

    I have a macro that i want to run in many files that have the same structure but diferent number of sheets. I can only change sheets by writing:

    Sheets("Sheet1").Activate

    I would like to know if there is a command that would work, something like:

    ActiveSheet.Activatenext (I tried this and didn't work)

    Can someone tell me how to do this?

  2. #2
    Bob Phillips
    Guest

    Re: How do make a macro activate the next sheet?

    Almost got it.

    activesheet.next.activate

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "pauloreiss" <pauloreiss.2141sy_1136378701.8605@excelforum-nospam.com> wrote
    in message news:pauloreiss.2141sy_1136378701.8605@excelforum-nospam.com...
    >
    > I have a macro that i want to run in many files that have the same
    > structure but diferent number of sheets. I can only change sheets by
    > writing:
    >
    > Sheets("Sheet1").Activate
    >
    > I would like to know if there is a command that would work, something
    > like:
    >
    > ActiveSheet.Activatenext (I tried this and didn't work)
    >
    > Can someone tell me how to do this?
    >
    >
    > --
    > pauloreiss
    > ------------------------------------------------------------------------
    > pauloreiss's Profile:

    http://www.excelforum.com/member.php...o&userid=29820
    > View this thread: http://www.excelforum.com/showthread...hreadid=497860
    >




  3. #3
    Norman Jones
    Guest

    Re: How do make a macro activate the next sheet?

    Hi Paul,

    Try:

    '=============>>
    Public Sub Tester01()
    Sub TestA()
    With ActiveSheet
    If .Index < Sheets.Count Then
    .Next.Activate
    Else
    Sheets(1).Activate
    End If
    End With
    End Sub
    '<<=============

    ---
    Regards,
    Norman



    "pauloreiss" <pauloreiss.2141sy_1136378701.8605@excelforum-nospam.com> wrote
    in message news:pauloreiss.2141sy_1136378701.8605@excelforum-nospam.com...
    >
    > I have a macro that i want to run in many files that have the same
    > structure but diferent number of sheets. I can only change sheets by
    > writing:
    >
    > Sheets("Sheet1").Activate
    >
    > I would like to know if there is a command that would work, something
    > like:
    >
    > ActiveSheet.Activatenext (I tried this and didn't work)
    >
    > Can someone tell me how to do this?
    >
    >
    > --
    > pauloreiss
    > ------------------------------------------------------------------------
    > pauloreiss's Profile:
    > http://www.excelforum.com/member.php...o&userid=29820
    > View this thread: http://www.excelforum.com/showthread...hreadid=497860
    >




+ 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