View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Tom Hutchins Tom Hutchins is offline
external usenet poster
 
Posts: 1,069
Default 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