File Name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello
I am opening a 8.prn file formatting the data and then moving the data into
another file. In the formatting portion I would like to add the filename to
A1. I think I need to use cell("Filename") but I am not quite sure how. Can
someone kindly help?
Thanks!
 
Try:

Path and filename

=SUBSTITUTE(SUBSTITUTE(LEFT(CELL("filename",A1),FIND("]",CELL("filename",A1))),"[",""),"]","")

filename only

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

Mike
 
Thanks
I already tried that. Apparently because its a txt/csv file there are no
occurence of ] in cell("filename")

Mike H said:
Try:

Path and filename

=SUBSTITUTE(SUBSTITUTE(LEFT(CELL("filename",A1),FIND("]",CELL("filename",A1))),"[",""),"]","")

filename only

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

Mike

Sandy said:
Hello
I am opening a 8.prn file formatting the data and then moving the data into
another file. In the formatting portion I would like to add the filename to
A1. I think I need to use cell("Filename") but I am not quite sure how. Can
someone kindly help?
Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top