Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 318
Default 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   Report Post  
Posted to microsoft.public.excel.misc
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

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
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
multiple sets words replace dk New Users to Excel 5 April 10th 08 12:20 AM
replace numbers in English words- Mani K Excel Worksheet Functions 2 February 12th 07 10:03 AM
IF formula in Excel / Replace numbers with 'words' Emsmaps Excel Discussion (Misc queries) 1 April 7th 06 11:01 PM
Replace a long list of abbreviations with full words in Excel jgundel Excel Worksheet Functions 3 February 7th 06 07:11 PM
Excel to replace words ? Andy100 New Users to Excel 13 August 28th 05 05:17 PM


All times are GMT +1. The time now is 12:41 AM.

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"