Paste filename to a cell

jsolomon

Board Regular
Joined
Mar 25, 2005
Messages
109
The subject really says it all, what I am trying to do is retrieve the filename of the workbook and paste it to an absolute cell.

Thanks!

Joe
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
How about just using the CELL formula?
=CELL("filename")

This returns the following for my current file:
D:\Data\Excel\[test.xls]Sheet1
 
Upvote 0
is there a way to do it without the path showing? I'd like to use the mid formula, but the path may change.

thanks for the help!

Joe
 
Upvote 0
Hi Joe


Try this (there may be a simpler way of doing it, but this does work):

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


Regards

Richard
 
Upvote 0

Forum statistics

Threads
1,223,460
Messages
6,172,345
Members
452,454
Latest member
MadamRedRabbit

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top