![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Location: Michigan, USA
Posts: 145
|
Is there a formula in Excel that will display the worksheet tab name when requested?
Thanks |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 10,387
|
Someone out there correct me if this is not the shortest or most efficient formula, but try:
=RIGHT(CELL("filename"),LEN(CELL("filename"))-SEARCH("]",CELL("filename"))) and be sure to immediately save the workbook. BTW, the VBA line of code to do this is [A1] = ActiveSheet.Name Tom Urtis |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Location: Michigan, USA
Posts: 145
|
Thanks for the response, but I do not believe
this works with multiple sheets. Every time that it recalculates every sheet takes on the same worksheet tab name. Maybe I have done it incorrectly. |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 10,387
|
Try pasting this into your workbook module, which will do the trick for all sheets in the workbook. Right click on the Excel workbook icon to the left of the File menu, near the upper left corner of the screen, then left click on View Code, and paste this in:
Private Sub Workbook_SheetActivate(ByVal Sh As Object) [A1] = ActiveSheet.Name End Sub Or, if you only want certain sheets that you decide shall have the sheet name displayed, use this code instead, by right clicking on the specific sheet tab(s), left clicking on View Code, and pasting this in: Private Sub Worksheet_Activate() [A1] = ActiveSheet.Name End Sub Tom Urtis |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|