ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ActiveNext (https://www.excelbanter.com/excel-programming/401514-activenext.html)

Esau[_3_]

ActiveNext
 
ActiveWindow.ActivateNext ----Is there a ActiveSheet.ActivateNext


--
Esau

Rick Rothstein \(MVP - VB\)

ActiveNext
 
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

Mike Fogleman

ActiveNext
 
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
"Esau" wrote in message
...
ActiveWindow.ActivateNext ----Is there a ActiveSheet.ActivateNext


--
Esau




Mike Fogleman

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

Mike F
"Mike Fogleman" wrote in message
...
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
"Esau" wrote in message
...
ActiveWindow.ActivateNext ----Is there a ActiveSheet.ActivateNext


--
Esau






Ron de Bruin

ActiveNext
 
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


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Esau" wrote in message ...
ActiveWindow.ActivateNext ----Is there a ActiveSheet.ActivateNext


--
Esau


Rick Rothstein \(MVP - VB\)

ActiveNext
 
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


Rick Rothstein \(MVP - VB\)

ActiveNext
 
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



All times are GMT +1. The time now is 06:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com