×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

filename in spreadsheet
3

filename in spreadsheet

filename in spreadsheet

(OP)
Is there an easy way to show a spreadsheet's filename and path without typing it in manually?

RE: filename in spreadsheet

Type in the cell where you want the filame:

=CELL("filename")

that should do

regards
Mogens

RE: filename in spreadsheet

(OP)
Thanks Mogen, works like a charm.

RE: filename in spreadsheet

2
I would advise you to use CELL("filename",A1) (or any other address of a cell on the sheet). That way you are sure that the filename+sheet tab name is always the name of the worksheet that the function is on (or more specifically, where the referenced cell is on).
Just using CELL("filename") can give funny results when working on multiple workbooks/sheets.

Regards,

Joerd

RE: filename in spreadsheet

Thats a good one joerd

I have experienced that, bud didn't know this option.

regards
Mogens

RE: filename in spreadsheet

Any way to just display the filename and not the path ?

RE: filename in spreadsheet

Yes, you have probably noticed that the CELL function gives you a long string, with the filename between square brackets.
So you "only"  have to parse the string, find the square brackets, and return the part of the string between the brackets as the filename.
All in one, this gives you something like:

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

Have fun.

Regards,

Joerd

RE: filename in spreadsheet

By the way, same can be done more nicely in VBA, by a user defined function:


Function Filename(r As Range)
    Application.Volatile
    Filename = r.Worksheet.Parent.Name
End Function


Call this function from your sheet as =Filename(A1), for example.

Regards,

Joerd

RE: filename in spreadsheet

Thanks
I had tried other ways but I was being too simplistic

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources