Display Sheet Name in a Cell

snolze123

New Member
Joined
Jun 16, 2008
Messages
7
How can I display the sheet name in the sheet itself? My sheets are named as territory numbers and I want cell A1 of each sheet to be something like

="Territory "&....

I know that this can be accomplished in the header/footer section but I'd prefer to have it in a cell if possible.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Try

=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-FIND("]",CELL("filename",A1)))
 
Upvote 0
Dear RichardSchollar & VoG II,

What is the benefit of having the cell reference A1 in the two formulas? I got both formulas to work without a cell reference. Here are the formulas I got to work:

=RIGHT(CELL("filename"),LEN(CELL("filename"))-FIND("]",CELL("filename")))

And

=REPLACE(CELL("filename"),1,FIND("]",CELL("filename")),"")

Is there a situation where leaving the A1 out would cause a problem?
 
Upvote 0
The purpose of the A1 in both formulas is to anchor it to that workbook. Not needed if you only have 1 workbook open at a time, but with 2 or more open, Excel can get confused. I believe it was Aladin that posted a good discussion of this many years ago

lenze
 
Upvote 0
Dear lenze,

Thank you for that! I have used formulas such as these without the A1 for years and I have always run into exactly that trouble. And I did not know why. Now I can amend my formulas and include the A1! Thanks lenze and Aladin!
 
Upvote 0
BTW, you can also use code. In the ThisWorkBook Module
Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Range("$A$1") = "Territory " & ActiveSheet.Name
End Sub

lenze
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,423
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top