ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Return Sheet# Sheet Name (https://www.excelbanter.com/excel-programming/373006-return-sheet-sheet-name.html)

steven

Return Sheet# Sheet Name
 
I notice in the VBA editor in the VBA project window there is always a Sheet#
and then the Sheet Name. For example: I change the name on Sheet2 to
"Journal" then in the VBA Project it wil show Sheet2 (Journal).

If in a macro I write:
MsgBox ActiveSheet.Name

It will return 'Journal' if I am in that sheet.

Question: I do I return to a variable the original name of the sheet that
appears in the VBA project window?

Thank you,

Steven

Die_Another_Day

Return Sheet# Sheet Name
 
Var1 = Sheets("Journal").CodeName

HTH

Charles Chickering
Steven wrote:
I notice in the VBA editor in the VBA project window there is always a Sheet#
and then the Sheet Name. For example: I change the name on Sheet2 to
"Journal" then in the VBA Project it wil show Sheet2 (Journal).

If in a macro I write:
MsgBox ActiveSheet.Name

It will return 'Journal' if I am in that sheet.

Question: I do I return to a variable the original name of the sheet that
appears in the VBA project window?

Thank you,

Steven



Tom Ogilvy

Return Sheet# Sheet Name
 
If you haven't just added the sheet with code,

Activesheet.Codename

--
Regards,
Tom Ogilvy


"Steven" wrote:

I notice in the VBA editor in the VBA project window there is always a Sheet#
and then the Sheet Name. For example: I change the name on Sheet2 to
"Journal" then in the VBA Project it wil show Sheet2 (Journal).

If in a macro I write:
MsgBox ActiveSheet.Name

It will return 'Journal' if I am in that sheet.

Question: I do I return to a variable the original name of the sheet that
appears in the VBA project window?

Thank you,

Steven



All times are GMT +1. The time now is 01:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com