Find and Replace

  • Thread starter Thread starter molinaram
  • Start date Start date
M

molinaram

Using VBA, is it possible to search a range for a value in one cell and
replace with a value in another cell? I have tried using the Record Macro
option and recorded the following (which, of course, does not work).

Application.Goto Reference:="SearchArea"
Cells.Replace What:=Range("R2C2"), Replacement:=Range("R2C3"),
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub

How can I modify it to make it work?

Any help is greatly appreciated.
 
Sub rplc()
Cells.Replace What:=Range("B2").Value, Replacement:=Range("C2").Value,
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub
 
Back
Top