View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
T. Valko T. Valko is offline
external usenet poster
 
Posts: 15,768
Default How can I show the current file name in a cell.

Try one of these** :

This will return the full path including the sheet name:

=CELL("filename",A1)

Result will be something like: C:\TV\[Sheet name.xls]Sheet1

This will return just the file name including the file extension:

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

Result will be something like: Sheet name.xls

** the file must already exist. In other words, it must have been saved at
least once and given a file name.


--
Biff
Microsoft Excel MVP


"Patrick" wrote in message
...
How do you get excel to return the name of the current workbook into a
certain cell.
I can get the directory name by typing =Info("directory"), but I cannot
get
the filename.
Is there a function that will return the current file name.

Thanks