Worksheet name

F

Frank Kabel

Hi
try one of the following formulas (note: the workbook has to be save
before). Just use the formulas as they are shown (don't replace
'filename' with anything)

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))
 
B

Bob Phillips

That and a bit more

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("]",CELL("fi
lename",A1),1)-FIND("[",CELL"filename",A1),1)-1)

The sheet name
=RIGHT(CELL("filename",A1),LEN(CELL("filename",A1))-FIND("]",CELL("filename"
,A1),1))

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
M

mzehr

AFAIK this has to be done via VBA as a User Defined
Function:

Function Sheetname() as String
Sheetname = Application.Caller.Parent.Name
End Function

Then you would use the formula =Sheetname()

HTH
 
M

mzehr

Thanks Frank! I've picked up a lot from you and the other
MVP's. I appreciate the contribution everyone makes to
this site.

Mike
 
Top