ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Importing Text file based on criteria (https://www.excelbanter.com/excel-discussion-misc-queries/83675-importing-text-file-based-criteria.html)

Martin

Importing Text file based on criteria
 
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.

mrice

Importing Text file based on criteria
 

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


--
mrice


------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=533614



All times are GMT +1. The time now is 03:04 PM.

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