ActiveSheet properties

PapaSmurf

Board Regular
Joined
Nov 4, 2005
Messages
105
I am trying to get the number of the active sheet.
eg.
Activesheet.name would produce "Sheet2"

I just want the number of the sheet so that i can select the previous sheet using;
Sheets(1). select

Thanks
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
I'm not 100% sure what you mean but you can get the sheets's index like this.
Code:
ActiveSheet.Index
and you can get it's code name like this
Code:
ActiveSheet.CodeName
 
Upvote 0
Hi PapaSmurf, welcome to the board!

How about this for selecting the previous sheet ...

Code:
On Error Resume Next
Sheets(ActiveSheet.Index - 1).Activate

You would need the On Error Resume Next statement if you were on sheets(1) when you ran this code. You could make it so that it would loop to the last sheet, and vice versa with the last sheet going to the first. If you'd like ..
 
Upvote 0
If you just want to activate the previous sheet.
Code:
ActiveSheet.Previous.Activate
 
Upvote 0

Forum statistics

Threads
1,218,909
Messages
6,145,169
Members
450,592
Latest member
Boulder127

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top