Microsoft Knowledge Base |
|
XL5: Returning the Filename to a Cell in the Worksheet |
|
|
Last reviewed: September 12, 1996
Article ID: Q121858 |
|
The information in this article applies to:
SUMMARYTo return the filename of a worksheet can to a cell in the document, use the appropriate formula below.
If you are using Microsoft Excel for Windows
=MID(CELL("filename"),MAX(IF(MID(CELL("filename"),ROW(1:256),1)="\",
ROW(1:2 56)))+1,255)
NOTE: This formula should be entered on one single line, and it must be
entered as an array formula. (To enter a formula as an array formula in
Microsoft Excel for Windows, press CTRL+SHIFT+ENTER.) Note also that
CELL("filename") returns the full path and filename for the file.
If you are using Microsoft Excel for the Macintosh
=MID(CELL("filename"),MAX(IF(MID(CELL("filename"),ROW(1:256),1)=":",
ROW(1:256)))+1,255)
NOTE: This formula should be entered on one single line, and it must be
entered as an array formula. (To enter a formula as an array formula in
Microsoft Excel for the Macintosh, press COMMAND+RETURN.) Note also that
CELL("filename") returns the full path and filename for the file.
MORE INFORMATIONThere is currently no single worksheet function that returns only the filename to a cell. However, you can create a Visual Basic, Applications Edition, procedure that uses ActiveWorkBook.Name to return the name of the active workbook to a cell.
|
|
KBCategory: kbusage
©1997 Microsoft Corporation. All rights reserved. Legal Notices. |