ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to extract file name for use in a cell? (https://www.excelbanter.com/excel-programming/383843-how-extract-file-name-use-cell.html)

[email protected]

How to extract file name for use in a cell?
 
Hi, Using XL2002 and Windows 2000

If I have a file named A00015249CR.csv and I want to
place the first 11 characters of the filename in a cell, how
would I do that, if it's possible.

What I need to do is run several scripts on files that return simialr
data, so inserting the filename into an inserted column at the left
of each dataset would allow me to combine the data into one file
and still know where each row of data originated.

Thanks in advance!

Norm


joel

How to extract file name for use in a cell?
 
Use the cell function

=cell("filename",A1) where A1 is any cell in the workbook associated with
the name yu are looking for.

" wrote:

Hi, Using XL2002 and Windows 2000

If I have a file named A00015249CR.csv and I want to
place the first 11 characters of the filename in a cell, how
would I do that, if it's possible.

What I need to do is run several scripts on files that return simialr
data, so inserting the filename into an inserted column at the left
of each dataset would allow me to combine the data into one file
and still know where each row of data originated.

Thanks in advance!

Norm



Tom Ogilvy

How to extract file name for use in a cell?
 
if you are doing it with code

Set bk = Activeworkbook
s = left(bk.Name,Instr(1,bk.name,".",vbTextcompare)-1)

--
Regards,
Tom Ogilvy


" wrote:

Hi, Using XL2002 and Windows 2000

If I have a file named A00015249CR.csv and I want to
place the first 11 characters of the filename in a cell, how
would I do that, if it's possible.

What I need to do is run several scripts on files that return simialr
data, so inserting the filename into an inserted column at the left
of each dataset would allow me to combine the data into one file
and still know where each row of data originated.

Thanks in advance!

Norm




All times are GMT +1. The time now is 01:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com