Sheet Name?

M

Michael Dobony

Is there a way to automatically enter the page/sheet name in a cell? I
have Excel 2007. I cant seem to find any info on this in the help menu.
Thanks.

Mike D.
 
D

Don Guillett Excel MVP

Is there a way to automatically enter the page/sheet name in a cell?  I
have Excel 2007. I cant seem to find any info on this in the help menu.
Thanks.

Mike D.

From an OLD post by Julian Milano
To display the full title of the workbook in a cell:
=CELL("FILENAME",F10)
eg. H:\MSOffice\Macros\[Accessing document properties.xls]Sheet1

To display the Path:
=MID(CELL("FILENAME",F8), 1,FIND("[",CELL("FILENAME",F8))-1)
eg. H:\MSOffice\Macros\

To display the filename:
=MID(CELL("FILENAME",F9),FIND("[",CELL("FILENAME",F9))
+1,FIND("]",CELL("FILE
NAME",F9))-FIND("[",CELL("FILENAME",F9))-1)
eg. Accessing document properties.xls

To display the Sheet name:
=MID(CELL("FILENAME",F10),FIND("]",CELL("FILENAME",F10))+1,255)
eg. Sheet1
 
J

Jim Cone

You are looking for the Cell function. It can return the file path/workbook name/sheet name.
You then have to pull the name you want from the formula...

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

--
Jim Cone
Portland, Oregon USA
Excel add-in: http://tinyurl.com/ExtrasXL

..
..
..

Is there a way to automatically enter the page/sheet name in a cell? I
have Excel 2007. I cant seem to find any info on this in the help menu.
Thanks.

Mike D.
 
S

Stan Brown

You are looking for the Cell function. It can return the file path/workbook name/sheet name.
You then have to pull the name you want from the formula...

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

That's very slick, Jim. (I wonder why Microsoft considers the sheet
name to be part of the file name, though.)

It might be worth mentioning that in a new workbook this won't work
till you save the workbook and hit F9 to force a recalculate.
(Tested in Excel 2010.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top