ActiveNext

  • Thread starter Thread starter Guest
  • Start date Start date
ActiveWindow.ActivateNext ----Is there a ActiveSheet.ActivateNext

You could always use something like this (it stops at the last sheet)...

Worksheets(ActiveSheet.Index-(ActiveSheet.Index<Worksheets.Count)).Activate

Rick
 
Not really. By using the worksheet index number you can activate the next
sheet tab to the right.

Worksheets(ActiveSheet.Index + 1).Activate

Mike F
 
Rick's reply is more accurate whereas mine would error out on the last
sheet.

Mike F
 
You can use

ActiveSheet.Next.Select

ActiveSheet.Previous.Select

But test where you are because it blow if you you are in the last/first sheet
 
ActiveWindow.ActivateNext ----Is there a ActiveSheet.ActivateNext
You could always use something like this (it stops at the last sheet)...

Worksheets(ActiveSheet.Index-(ActiveSheet.Index<Worksheets.Count)).Activate

As I said, the above code stops the indexing at the last sheet. If, after
you reach the last sheet, you wanted to wrap back around to the first sheet,
give this a try...

Worksheets(ActiveSheet.Index + 1 + Worksheets.Count * _
(ActiveSheet.Index + 1 > Worksheets.Count)).Activate


Rick
 
As I said, the above code stops the indexing at the last sheet. If, after
you reach the last sheet, you wanted to wrap back around to the first
sheet, give this a try...

Worksheets(ActiveSheet.Index + 1 + Worksheets.Count * _
(ActiveSheet.Index + 1 > Worksheets.Count)).Activate

And if you need code to move to the Previous sheet where, if the ActiveSheet
is the first one, it wraps back around to the last sheet, this code will do
that...

Worksheets(ActiveSheet.Index - 1 - Worksheets.Count * _
(ActiveSheet.Index = 1)).Activate

Rick
 

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