Activesheet.name as a formula not code?

KniteMare

Board Regular
Joined
Mar 4, 2002
Messages
238
I wish to return the name of the sheet in cell D1. I know how to do this in code.
But, is it possible to do with just a formula? =(SheetName) or some such.

I wish to use this as a template for my 18 facilities and have the sheet refer to D1 where ever the facility name needs to be. This way I just have to type it one time.

Any help or questions are appreciated.

KniteMare
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
This is one way --

=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-FIND("]",CELL("filename",A1)))
 
Upvote 0
Thanks that does the trick. Now as to why does that work???
KniteMare


EDIT Follows
OK I got it.

Return all the text to the right of the ] char.
By finding the position of the ] and subtracting that from the total length
and returning that many char from the right.

Thanks so much for the help.
End EDIT
Knite Mare
 
Upvote 0
The CELL function is an information function, one of whose arguments can be "filename" -- see the help file for the others. [2nd arg = reference of 1st arg]

However, by itself, CELL... returns the Full name, including path/file/sheet, as in --

C:\Documents and Settings\Administrator\My Documents\MrExcel\[FUNCTIONS.xls]Sheetname reference

In order to strip out just the sheetname, we want the RIGHT most portion only, of a length equal to the length of the entire above string less the position number of the closing "]" around the filename: in this case, the LEN function returns 95, the FIND function returns 76, leaving 19.
 
Upvote 0
Right, I looked up each piece of the function in my trusty MicroSoft Excel 97 Worksheet Function Reference, AFTER you pointed me in the correct direction. Without your assistance I would never have thought to Look up the CELL function as a starting point for this procedure.
KniteMare
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,731
Members
448,987
Latest member
marion_davis

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