Find and Replace

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.
 
J

JLGWhiz

Sub rplc()
Cells.Replace What:=Range("B2").Value, Replacement:=Range("C2").Value,
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub
 

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