We help IT Professionals succeed at work.

Excel worksheet name

In VBA you can name a worksheet through its properties window.  

This is not the same name that is displayed on a tab.  This method is an attempt to keep the sheet name constant so that if a user renames a sheet, you can still control it.

My problem is that I need to determine which sheet I am on using that same VBA name property.
Comment
Watch Question

Top Expert 2008

Commented:
Then name them the same. I name my sheets like this:

Tab Name: My Sheet
VBA Name: wksMySheet

Kevin
Do you want

Activesheet.name
make the first row(1) and column(A) hidden and put some secret text in cell A1. (or any other cell of your choice.)

In the VBA script loop through all the sheets and where every you find the secret key in cell A1 rename the sheet to the desired name.
Top Expert 2008

Commented:
Can you be more explicit about what your question is? What are you trying to do?

Kevin
or

activesheet.codename
Sheldon LivingstonConsultant

Author

Commented:
Kevin... let's say I name them the same and the user changes the name?

ssaqibh:  ActiveSheet.name gives you the name on the tab.

viralypatel:  Trying not to resort to that kind of a work around.

So, the first sheet tab and show Sheet1 and the second one can show Sheet2.  You can change, from Atl + F11, the name "propertiy" of the sheets to wksFirst and wksSecond.  Now the user changs the tabs to read Sheet A and Sheet B.  From VBA how do I know if the active sheet is wksSecond, Sheet B or Sheet2?
Sheldon LivingstonConsultant

Author

Commented:
ssaqibh:  !!!!

Thanks  

codename is it.
Sheldon LivingstonConsultant

Author

Commented:
Perfect!