I want a cell to show the current filename automatically.

T

Troy

I am trying to set up a spreadsheet for work. I want a specified cell to
automatically show the filename of the current file.
 
S

SteveG

Troy,

In the cell that you want the filename to appear.

=CELL("filename",A1)

Reference can be any cell in the workbook. It will show the full pat
and sheet like.

C:\Documents and Settings\doeJ\My Documents\[Filename.xls]Sheet1


HTH

Stev
 
T

Troy

But what if I want only the file anme to show and not the entire path? Also,
what exactly goes in the cell? I am looking at your post and not sure how to
insert the information.
 
S

Sloth

You must save the file at least once before these formulas will work.

=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-5)

returns name -without extension "Filename"

=MID(CELL("filename",A1),FIND("[",CELL("filename",A1))+1,FIND("]",CELL("filename",A1))-FIND("[",CELL("filename",A1))-1)

returns name with extension "Filename.xls"


Troy said:
But what if I want only the file anme to show and not the entire path? Also,
what exactly goes in the cell? I am looking at your post and not sure how to
insert the information.

SteveG said:
Troy,

In the cell that you want the filename to appear.

=CELL("filename",A1)

Reference can be any cell in the workbook. It will show the full path
and sheet like.

C:\Documents and Settings\doeJ\My Documents\[Filename.xls]Sheet1


HTH

Steve
 
Top