How to insert in cell A1 the name on the tab

andreascostas

Board Regular
Joined
Jan 11, 2011
Messages
150
Is there a way to insert the name on the tab of an excel sheet into cell A1
without having to type it every time?
 
This may be closer, but I'm still not 100% sure

Rich (BB code):
Function sheet_name(r As Range)
  Application.Volatile
  sheet_name = r.Parent.Name
End Function

It works in tests.


Although I also tried volatile in my previous tests and didn't update, that's why I decided to go to set activesheet.


Maybe it would be good if the OP told us what he wants the name of the sheet, that would serve to find the right solution.
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Maybe it would be good if the OP told us what he wants the name of the sheet, that would serve to find the right solution.
It would be interesting to know, but whatever the reason, the formula solution will produce the correct result won't it? With the added advantage that it is not dependant on the user having macros enabled.

Further, presumably the OP will know whether it is even remotely possible that the unusual circumstance I outlined in post 11 could occur (or easily prevent by giving the file name a name longer than 31 characters) so the fairly simple formula in the original link supplied by Joe should suffice (or with the 31 modification :))
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,148
Members
453,021
Latest member
Justyna P

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