How do make a macro activate the next sheet?

  • Thread starter Thread starter pauloreiss
  • Start date Start date
P

pauloreiss

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?
 
Almost got it.

activesheet.next.activate

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
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
'<<=============
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top