Putting worksheet name into cell on that sheet

shades

Well-known Member
Joined
Mar 20, 2002
Messages
1,550
I remember seeing a response recently about a formula that takes the worksheet "name" and then inserts that into a cell on that worksheet.


[Nuts! I tried to search, but the search function isn't working right now, and I have searched 25+ pages and can't find what I need.]
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
On 2002-04-12 12:49, shades wrote:
I remember seeing a response recently about a formula that takes the worksheet "name" and then inserts that into a cell on that worksheet.


[Nuts! I tried to search, but the search function isn't working right now, and I have searched 25+ pages and can't find what I need.]

Try =MID(CELL("filename"),FIND("]",CELL("filename"),1)+1,255)
 
Upvote 0
Thanks, Ivan, that's the approach I'm looking for.

However, that only works once in the entire workbook.

I have seven tabs: Q1-01, Q2-01, Q3-01 Q4-01, Q1-Q2, Q1-Q3, Q1-Q4.

Once I pasted in your formula into cell Q1-01!J3, it did what I wanted ("Q1-01" was in the cell). But when I pasted the formula into another sheet (Q2-01!J3), it took the name of that one ("Q2-01"), and then when I went back to worksheet Q1-01, that cell (Q1-01!J3) had changed to Q2-01.
 
Upvote 0
Hi,

If you want a worksheet function which is easier to use than the =MID(CELL(....

try the following UDF:

Public Function NameSheet()
NameSheet = Application.Caller.Parent.Name
End Function

Called as =NAMESHEET()
 
Upvote 0
if you use Ivan's approach you should add a cell reference (a1) after "filename" to the formula to assure you get name of the active sheet without the need to recalc:

=MID(CELL("filename",a1),FIND("]",CELL("filename",a1),1)+1,255)
 
Upvote 0
Thanks, everyone!

Ricky, that little extra made the difference. And all of you made my day!!! :)
 
Upvote 0
On 2002-04-12 13:14, Ricky Morris wrote:
if you use Ivan's approach you should add a cell reference (a1) after "filename" to the formula to assure you get name of the active sheet without the need to recalc:

=MID(CELL("filename",a1),FIND("]",CELL("filename",a1),1)+1,255)

Good one Ricky...I'd forgotten about that for
Multisheet use.
 
Upvote 0

Forum statistics

Threads
1,214,516
Messages
6,119,978
Members
448,934
Latest member
audette89

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