Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Replace several words to One
Hello How do I correct the macro below. I want to change the words FXG,
FXR, GFX, and FXT to say FAX Thank you thank you Range("C1:C3169").Select Selection.Replace What:=("FXG""FXR""GFX""FXT")Replacement:="FAX", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False End Sub |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Replace several words to One
One way...
Sub AAA() Range("C1:C3169").Select Call ReplaceText("FXG", "FAX") Call ReplaceText("FXR", "FAX") Call ReplaceText("GFX", "FAX") Call ReplaceText("FXT", "FAX") End Sub Sub ReplaceText(FromTxt As String, ToTxt As String) Selection.Replace What:=FromTxt$, Replacement:=ToTxt$, LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False End Sub Hope this helps, Hutch "Wanna Learn" wrote: Hello How do I correct the macro below. I want to change the words FXG, FXR, GFX, and FXT to say FAX Thank you thank you Range("C1:C3169").Select Selection.Replace What:=("FXG""FXR""GFX""FXT")Replacement:="FAX", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False End Sub |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Replace several words to One
dim myWords as Variant
dim wCtr as long myWords = array("FXG","FXR","GFX","FXT") for wctr = lbound(mywords) to ubound(mywords) activesheet.range("c1:C3169").replace what:=mywords(wctr), _ replacement:="FAX", lookat:=xlPart, SearchOrder:=xlByRows, _ MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False next wctr Wanna Learn wrote: Hello How do I correct the macro below. I want to change the words FXG, FXR, GFX, and FXT to say FAX Thank you thank you Range("C1:C3169").Select Selection.Replace What:=("FXG""FXR""GFX""FXT")Replacement:="FAX", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _ ReplaceFormat:=False End Sub -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
multiple sets words replace | New Users to Excel | |||
replace numbers in English words- | Excel Worksheet Functions | |||
IF formula in Excel / Replace numbers with 'words' | Excel Discussion (Misc queries) | |||
Replace a long list of abbreviations with full words in Excel | Excel Worksheet Functions | |||
Excel to replace words ? | New Users to Excel |