Filename

  • Thread starter Thread starter Diane
  • Start date Start date
D

Diane

How do I insert a formula in a worksheet to give me the
path of my saved file? Thanks for responding.
 
Hi Diane
try the following formulas

File path and file name:
=CELL("filename",A1)

File path only
=LEFT(CELL("filename",A1),FIND("[",CELL("filename",A1),1)-1)

File name only
=MID(CELL("filename",A1),FIND("[",CELL("filename",A1),1)+1,FIND("]",CEL
L("filename",A1),1)-FIND("[",CELL("filename",A1),1)-1)

The sheet name
=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-FIND("]",CELL("file
name",A1),1))
 
Create the following function:

Public Function Path()
Path = ActiveWorkbook.Path
End Function

Then you can use the function =path() in a cell to return the active
workbook path. Returns a #NAME? error if workbook is unsaved.
 
Back
Top