macro for matching contents in external file

  • Thread starter Thread starter Lory
  • Start date Start date
L

Lory

Hello All,

I have two text files (lets say A.txt and B.txt) and in each of thes
text files, there are two columns. One is "description" the other i
"name". Furthermore, I have a huge spreadsheet with many columns an
rows. In this spreadsheet, in columns B and D are the "description"
which is exactly the same as the ones in the two text files. I woul
like to write a macro that searches these two text files for th
matching "description" and put the corresponding "name" in columns
and C. (example: macro starts matchng the first row of column B and i
finds a match in A.txt and puts the corresponding "name" in column A o
the spreadsheet)

In column E, I would like the macro to put the word A or B depending o
which file the match was found.

Is this do-able??? Please advise....

Many thanks!
-Lor
 
Rather then doing it completely in VBA (which is perfectly possible),why
not use VLOOKUP worksheetfunctons?

Create a link to the file containing the text (or create a query to
import it to another sheet)

In the "database", use an ID to reference an item instead of typing the
desciption.

Then in the description column enter a vlookup formula to retrieve the
description from the "Text" table.

keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 
Back
Top