How can I show the current file name in a cell.
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 |
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 |
How can I show the current file name in a cell.
Perhaps have a look at
http://spreadsheetpage.com/index.php...vba_functions/ Success! -- met vriendelijke groetjes "Patrick" schreef in bericht ... 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 |
How can I show the current file name in a cell.
hi, Patrick !
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. for the current (and saved) workbook... path: =left(cell("filename"),find("[",cell("filename"))-2) name: =mid(cell("filename"),find("[",cell("filename"))+1,find("]",cell("filename"))-find("[",cell("filename"))-5) sheet: =mid(cell("filename"),search("]",cell("filename"))+1,now()) when the workbook has only one sheet names same as the workbook... sheet: =mid(cell("filename"),if(iserror(find("]",cell("filename"))),lookup(2,1/(mid(cell("filename"),row($1:$255),1)="\"),row($1: $255))+1,find("]",cell("filename"))+1),31) hth, hector. |
All times are GMT +1. The time now is 07:50 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com