Find and Replace in different cell

cmschmitz24

Board Regular
Joined
Jan 27, 2017
Messages
150
Can someone help me with a tweak to the find and replace code to replace in a different cell.

Code:
Range(Selection, Selection.End(xlDown)).Select
    Cells.Replace What:="00600629", Replacement:="Christina", LookAt:=xlPart, SearchOrder:= _
        xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False

Find 00600629 in column E
Replace with Christina in column F, same cell number
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi,
Try the below code,

Sub FindReplace()
Range("E1").Activate
Do Until ActiveCell.Value = ""
If InStr(1, ActiveCell.Value, "00600629") > 0 Then
ActiveCell.Offset(0, 1).Value = "Christina"
End If
ActiveCell.Offset(1, 0).Activate
Loop
End Sub
 
Upvote 0
Another option
Code:
Sub OffsetReplace()

   With Range("F2", Range("F" & Rows.Count).End(xlUp))
      .Value = Evaluate("IF(ISNUMBER(FIND(""00600629""," & .Offset(, -1).Address & ")),""Christina""," & .Address & ")")
   End With
End Sub
 
Upvote 0
Another option
Code:
Sub OffsetReplace()

   With Range("F2", Range("F" & Rows.Count).End(xlUp))
      .Value = Evaluate("IF(ISNUMBER(FIND(""00600629""," & .Offset(, -1).Address & ")),""Christina""," & .Address & ")")
   End With
End Sub

Fluff, this worked perfectly! Thanks so much!
 
Upvote 0
Glad to help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,465
Messages
6,124,975
Members
449,200
Latest member
Jamil ahmed

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top