Importing Text file based on criteria

M

Martin

I need help in how to do this:
Once I key in a Lot number at column A, column B will auto import the text
file based on the lot number in cell A1 (or the nearest match) from a folder
in worksheet B.
How to program it? Thanks.
 
M

mrice

You need to create a macro linked to the worksheet_change event of your
first sheet which will then lookup the value in the second sheet and
then use a file open such as

Open "C:\sgdkjagsd.txt" For Input As #1
Do while not EOF(1)
Line input #1, FileLine
Cells(65536,1).end(xlup).offset(1,0) = FileLine
Loop

Close #1
 
Top