I have code which replaces part of string in column A in sheet "Data" with new value written in Column B of sheet "Filter".
Column A of sheet "Filter" has old values, and Column B has values after replacement, see picture:
I know how to replace for example "Griffith RV8" into "Griffith RV-8" but how can I do that replacement plus remove all characters in front of that replaced string?
Griffith RV8 = RV-8
Sub Substitutions()
Dim rngData As Range
Dim rngLookup As Range
Dim Lookup As Range
With Sheets("Data")
Set rngData = .Range("A1", .Range("A" & Rows.Count).End(xlUp))
End With
With Sheets("Filter")
Set rngLookup = .Range("A1", .Range("A" & Rows.Count).End(xlUp))
End With
For Each Lookup In rngLookup
If Lookup.Value <> "" Then
rngData.Replace What:=Lookup.Value, _
Replacement:=Lookup.Offset(0, 1).Value, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False
End If
Next Lookup
End Sub
