Formula to obtain worksheet's name?

ianccy

Active Member
Joined
Jul 28, 2002
Messages
332
I want to enter a formula to a cell so that it equals the name of the worksheet, anyone?

Thanks
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
On 2002-10-15 06:29, ianccy wrote:
I want to enter a formula to a cell so that it equals the name of the worksheet, anyone?

Thanks

In A1 enter:

=CELL("filename",Sheet1!A1)

In B1 enter:

=RIGHT(A1,LEN(A1)-SEARCH("@#",SUBSTITUTE(A1,"]","@#",LEN(A1)-LEN(SUBSTITUTE(A1,"]","")))))
 
Upvote 0
You can do it with a litthe bit of code in a macro

sub sheet ident()

' Select a target cell for the result

Range("R39").Select
ActiveCell = ThisWorkbook.Name


End Sub



Hope this helps.

Whoopee answered a Vba question

:) DaveA :) :wink:
 
Upvote 0
Or this, courtesy of Bill Manville.

=MID(CELL("filename",A2),FIND("]",CELL("filename",A2))+1,255)
 
Upvote 0
On 2002-10-15 07:16, dk wrote:
Or this, courtesy of Bill Manville.

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

If you installed the morefunc.xll add-in, we can make it shorter & more efficient:

=WMID(CELL("filename",A1),-1,1,"]")

or just

=SHEETNAME() :biggrin:

Aladin
This message was edited by Aladin Akyurek on 2002-10-15 07:48
 
Upvote 0

Forum statistics

Threads
1,217,673
Messages
6,137,919
Members
450,098
Latest member
Ikmal Sabri

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