Tim Hanson
Member
The code replaces the value in Col C of the sheet "Age" if it matches a value in col A on the Sheet "FindReplace" with it paired value in col B.
This works good but I need to continue to match the value in col C on the "Age" sheet but actuly replace the value in col B when a value is matched
I have tryed offset(,-1) but this has no effect
I have uploaded a workbook that show more clearly what I need
Thanks
This works good but I need to continue to match the value in col C on the "Age" sheet but actuly replace the value in col B when a value is matched
I have tryed offset(,-1) but this has no effect
I have uploaded a workbook that show more clearly what I need
Thanks
Code:
.Columns("C:C").Offset(,-1).Replace FindValues(i, 1), ReplaceValues(i, 1), xlWhole, xlByColumns, False
Code:
Sub FindReplace()
Dim FindValues As Variant, ReplaceValues As Variant
Dim wsFR As Worksheet, wsTarget As Worksheet
Dim lRow As Long, i As Long
Set wsFR = ThisWorkbook.Worksheets("FindReplace")
Set wsTarget = ThisWorkbook.Worksheets("Age")
lRow = wsFR.Range("A" & wsFR.Rows.Count).End(xlUp).Row
With wsTarget
FindValues = wsFR.Range("A2:A" & lRow).Value
ReplaceValues = wsFR.Range("B2:B" & lRow).Value
For i = LBound(FindValues) To UBound(FindValues)
.Columns("C:C").Replace FindValues(i, 1), ReplaceValues(i, 1), xlWhole, xlByColumns, False
Next i
End With
End Sub