Tidy up multiple find and replace code

P

PSM

How can I tidy up this code as it goes on for 50+ searches ?


' Update_C5&Mgr (Select Columns)
Range("A:B").Select
Range(Selection, Selection.End(xlDown)).Select

' Update_C5 (Column A)
Selection.Replace What:="*01", _
Replacement:="01", LookAt:=xlPart, SearchOrder:=xlByRows,
MatchCase:= _
False, SearchFormat:=False, ReplaceFormat:=False
Selection.Replace What:="*07", _
Replacement:="07", LookAt:=xlPart, SearchOrder:=xlByRows,
MatchCase:= _
False, SearchFormat:=False, ReplaceFormat:=False
Selection.Replace What:="*08", _
Replacement:="08", LookAt:=xlPart, SearchOrder:=xlByRows,
MatchCase:= _
False, SearchFormat:=False, ReplaceFormat:=False
Selection.Replace What:="*09", _
Replacement:="09", LookAt:=xlPart, SearchOrder:=xlByRows,
MatchCase:= _
False, SearchFormat:=False, ReplaceFormat:=False
 
J

joel

ReplaceStr = Array("01,"07","08","09")

' Update_C5&Mgr (Select Columns)
Range("A:B").Select
Range(Selection, Selection.End(xlDown)).Select

for each Num in ReplaceStr
Selection.Replace _
What:="*" & Num, _
Replacement:=Num, _
LookAt:=xlPart

next Num
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top