View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Is there an easy way to replace list A instances with list B instances (sorted lists).

I would open the text file in Excel. then use the Built in Edit=Replace on
the entire sheet, with the macro recorder turned on. Then you can modify
the code to loop through your list1 and repeate the Replace using your
pairs of strings.

--
Regards,
Tom Ogilvy

"kkip" wrote in message
...
Thanks Tom, I'm a newbie to this group, and am trying to figure out how to

post as well as how to use Excel. I'm used to UNIX (where I know just about
enough to be dangerous to myself).
So... I have 2 columnar lists. Of course, I can copy and paste

them into 1 file to build a macro, or whatever.
Here is an example

(list 1) (list 2)
1 a
2 g
3 hlk
rtl gbc
dog cat
11 pig
fig dog

I have a separate text file in which I have strings from list 1 which I

wish to change to strings from list 2. In this example, I would want the
text "1 rtl this is a silly example fig 11" to be changed to "a gbc this is
a silly example dog pig". In addition, I would want any of the exact strings
replaced globally (throughout the file).
Is the answer to create a macro to do the first substitution, and then

edit the macro to populate it with my strings of both lists? I get line
breaks in inconvenient locations in the macro editor - do they matter? It
seems cumbersome. This is something that I and several other people will be
doing repeatedly with different lists, so simplicity is desired.
Thanks in advance.
Ken