How to find index number of renamed sheets in excel-vba

I have about 8 sheets in a book with different names. Is there a way to use VBA to activate one or more of these sheets based on their index number? For example, I have sheets with the names "Month", "Name", "Age", etc. .... how can I find their index number?

+4
source share
2 answers

try it

Sheets("<sheet Name>").Index

If you want a code name

Sheets("<sheet Name>").codename

It is possible that the sheet name is different from the code name. When you create a sheet, the sheet name and code name are the same, but changing the sheet name does not change the code name and changing the code name (using the Properties window in the Visual Basic Editor) does not change the sheet name.

+10

:
sheets("month").index

:
sheets(5).activate

+2