I am tiring alter a macro by seting a range as my array
This works fine
Sub FindReplaceByArrays()
Dim FindValues As Variant
Dim ReplaceValues As Variant
Dim i As Long
FindValues = Array("Find1", "Find2", "Find3")
ReplaceValues = Array("Replace1", "Replace2", "Replace3")
Sheets("UnPivot").Select
For i = LBound(FindValues) To UBound(FindValues)
Columns("P:P").Replace FindValues(i), ReplaceValues(i), xlWhole, xlByColumns, False
Next i
End Sub
Tiring to change to the following Sub but get error "Script out of range` and
Columns("P:P").Replace FindValues(i), ReplaceValues(i), xlWhole, xlByColumns, False
is high lighted
Thanks
Sub FindReplaceByArrays2()
Dim FindValues() As Variant
Dim ReplaceValues() As Variant
Dim i As Long
Sheets("UnPivot").Select
FindValues = Range("S2:S30")
ReplaceValues = Range("T2:T30")
For i = LBound(FindValues) To UBound(FindValues)
Columns("P:P").Replace FindValues(i), ReplaceValues(i), xlWhole, xlByColumns, False
Next i
End Sub