Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macro for matching contents in external file

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

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default macro for matching contents in external file

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


Lory wrote:

Hello All,

I have two text files (lets say A.txt and B.txt) and in each of these
text files, there are two columns. One is "description" the other is
"name". Furthermore, I have a huge spreadsheet with many columns and
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 would
like to write a macro that searches these two text files for the
matching "description" and put the corresponding "name" in columns A
and C. (example: macro starts matchng the first row of column B and it
finds a match in A.txt and puts the corresponding "name" in column A

of
the spreadsheet)

In column E, I would like the macro to put the word A or B depending

on
which file the match was found.

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

Many thanks!
-Lory


---
Message posted from http://www.ExcelForum.com/


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2007 Macro to Open File, Delete Contents, Save New File Flintstone[_2_] Excel Discussion (Misc queries) 2 February 1st 10 11:25 PM
Macro to insert a hyperlink to external file dadouza Excel Discussion (Misc queries) 2 August 1st 08 01:27 AM
How to save file in a macro taking new name from cell contents? LowIQ Excel Discussion (Misc queries) 3 May 31st 06 10:52 PM
Use macro code from external xls file Angus Comber[_2_] Excel Programming 1 November 10th 03 11:10 PM
How to open a zip file and extract its contents in a macro? Audie G. Bencosme R. Excel Programming 1 October 2nd 03 03:52 AM


All times are GMT +1. The time now is 03:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"