Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
MACRO: Multiple Find / Replace | Excel Programming | |||
replace multiple entries in excel state=st west=w east=e continue | Excel Worksheet Functions | |||
How to Replace multiple words to replace using excell | Excel Programming | |||
How can I replace multiple data in excel ? | Excel Discussion (Misc queries) | |||
VBA in Microsoft Excel: Find & Replace method macro across multiple files | Excel Programming |