Can a cell contain the filename of its workbook?
IE: If workbook's filename is "My Spreadsheet.xls", can cell A1 contain a formula so that it displays this in the cell?
Thanks,
Can a cell contain the filename of its workbook?
IE: If workbook's filename is "My Spreadsheet.xls", can cell A1 contain a formula so that it displays this in the cell?
Thanks,
For any of these to work the workbook must be saved first
=CELL("filename",A1) - Full file path, including worksheet name
=LEFT(CELL("filename",A1), FIND("]",CELL("filename", A1))) - Full file path
=LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1)) - 2) - Path only
=MID(LEFT(CELL("filename",A1), FIND("]", CELL("filename", A1))- 1), FIND("[",CELL("filename", A1))+1, 255) - File name only
=MID(CELL("filename",A1), FIND("]", CELL("filename", A1))+ 1, 255) - Worksheet name only
oldchippy
-------------
![]()
![]()
Blessed are those who can give without remembering and take without forgetting
If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.
Click here >>> Top Excel links for beginners to Experts
Forum Rules >>>Please don't forget to read these
Not sure if a formula can do it, but with VBA it's real easy and not complicated at all.
Edit:
Yes it can!![]()
Thanks guys - I can do it in VBA, but just wondered if a formula could. And now I know - cheers!
Glad you got it sorted out - thanks for the feedback
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks