Get name of active sheet

  • Follow


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

0
Reply Robert 12/3/2009 8:49:27 AM

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

"Robert Crandal" <nobody@gmail.com> wrote in message 
news:rYKRm.37967$cd7.21261@newsfe04.iad...
>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
> 


0
Reply Peter 12/3/2009 9:02:48 AM


Hi,

MsgBox ActiveSheet.CodeName

Mike

"Robert Crandal" wrote:

> 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
> 
> .
> 
0
Reply Utf 12/3/2009 9:29:02 AM

2 Replies
145 Views

(page loaded in 0.039 seconds)


Reply: