Excel filename into cell

  • Thread starter Jean-Paul De Winter
  • Start date
J

Jean-Paul De Winter

Hi,

Is it possible to get the filename of an excel-file into cel A1?

Thanks
 
S

Sandy V

With a formula for a Saved file, there are various ways
such as:

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

above as one line

Or with vba,

Sub test2()

Range("A1").Value = ActiveWorkbook.Name
End Sub

Regards,
Sandy
 
F

Frank Kabel

Hi
Use (just insert the formulas as-is. Note: the workbook
has to be saved before)
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1),1)
+1,FIND("]",CELL("filename",A1),1)-FIND("[",CELL
("filename",A1),1)-1)
 
J

Jean-Paul De Winter

Thanks for the reply...
Tried to enter it in cell A1 but got an error ....
JP
Frank Kabel said:
Hi
Use (just insert the formulas as-is. Note: the workbook
has to be saved before)
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1),1)
+1,FIND("]",CELL("filename",A1),1)-FIND("[",CELL
("filename",A1),1)-1)
-----Original Message-----
Hi,

Is it possible to get the filename of an excel-file into cel A1?

Thanks


.
 
Top