Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Multiple replace in Excel - macro ?


Hi Guys ,

I have a an excel book . In column A : words . In column B also words ,
synonyms for words in A column . Word(s) from B1 cell is/are synonym(s)
for what is in A1 cell . And so on

In D column i have text , a lot of text , in every cell .

The macro should read every cell in D column and , if it finds words
that are also in A column , it should replace that word with
corresponding word (synonym ) from B column . I give an example :

Let's say the result should be put in E column


A1: apartment B1 : dwelling D1: My mother enjoys his apartment
A2: enjoys B2 : likes

E1 should be : My mother likes his dwelling


Something like that

Many thanks


--
andrei
------------------------------------------------------------------------
andrei's Profile: 1056
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=193384

http://www.thecodecage.com/forumz

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Multiple replace in Excel - macro ?

Give this macro a try...

Sub SynonymReplacements()
Dim X As Long, LastRow As Long
Const StartRow As Long = 2
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For X = StartRow To LastRow
Columns("D").Replace What:=Cells(X, "A").Value, _
Replacement:=Cells(X, "B").Value, _
LookAt:=xlPart, MatchCase:=False
Next
End Sub

--
Rick (MVP - Excel)



"andrei" wrote in message
...

Hi Guys ,

I have a an excel book . In column A : words . In column B also words ,
synonyms for words in A column . Word(s) from B1 cell is/are synonym(s)
for what is in A1 cell . And so on

In D column i have text , a lot of text , in every cell .

The macro should read every cell in D column and , if it finds words
that are also in A column , it should replace that word with
corresponding word (synonym ) from B column . I give an example :

Let's say the result should be put in E column


A1: apartment B1 : dwelling D1: My mother enjoys his apartment
A2: enjoys B2 : likes

E1 should be : My mother likes his dwelling


Something like that

Many thanks


--
andrei
------------------------------------------------------------------------
andrei's Profile: 1056
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=193384

http://www.thecodecage.com/forumz

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Multiple replace in Excel - macro ?


it works . many thanks !


--
andrei
------------------------------------------------------------------------
andrei's Profile: 1056
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=193384

http://www.thecodecage.com/forumz

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
MACRO: Multiple Find / Replace mami Excel Programming 3 July 23rd 08 02:29 PM
replace multiple entries in excel state=st west=w east=e continue Teethless mama Excel Worksheet Functions 0 November 29th 06 08:41 PM
How to Replace multiple words to replace using excell ramsun Excel Programming 1 August 10th 06 01:52 PM
How can I replace multiple data in excel ? Nanou Excel Discussion (Misc queries) 3 June 2nd 06 04:27 PM
VBA in Microsoft Excel: Find & Replace method macro across multiple files Pedro123 Excel Programming 0 September 7th 05 03:48 PM


All times are GMT +1. The time now is 12:55 PM.

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

About Us

"It's about Microsoft Excel"