Using sheet reference instead of name

M

Michelle

IN the VBE each sheet has a name that looks like "Sheet5(Data)"...
the sheet name is data, and I v=can refer to Sheets("Data"), How can I use
the sheet5 bit - the sheet's 'VB Name'?

Thanks

M
 
J

Jacob Skaria

Use the index number such as

Msgbox Sheets(5).name

If this post helps click Yes
 
M

Michelle

No guys, this is just theindex position of the sheet within the book and it
changes according to where the sheet comes in the book.

I am looking for a way of refering to the sheet regardless of its name or
position.

Any ideas?

M
 
S

Sam Wilson

Ah,

..codename

sub test

dim ws as worksheet
for each ws in activebook.worksheets
msgbox ws.codename & " - " & ws.name
next ws

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

Top