Get name of active sheet

R

Robert Crandal

I have one sheet in my workbook named "Work Data".
If this sheet is active, then the following expression

Application.ActiveSheet.Name

.... will return a string of "Work Data". However, I don't
want the name of the string in the sheet tab, I want the name from
my VBA project window (named Sheet1). How can I retrieve
the VBA name of my sheet??

thank u
 
P

Peter T

Application.ActiveSheet.CodeName

Be aware though that newly added sheets since the workbook was opened while
the VBE is closed will not have a codeName. There are various workarounds to
force one, search this ng.

Regards,
Peter T
 

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