seven1four
New Member
- Joined
- Jan 18, 2019
- Messages
- 7
I would like to find and replace the selected cells on the active sheet. (selected by mouse before a run the macro)
On sheet2 i have a reference table column a is keyword column is replacement.
I found this macro but it replaces the whole active sheet.
Sub Macro1()
Dim i As Integer
Dim FindStr As String
Dim RepStr As String
For i = 1 To 2
FindStr = Sheet2.Range("A" & i).Value
RepStr = Sheet2.Range("B" & i).Value
Sheet1.Cells.Replace What:=FindStr, Replacement:=RepStr
Next i
End Sub
Thank you.
On sheet2 i have a reference table column a is keyword column is replacement.
I found this macro but it replaces the whole active sheet.
Sub Macro1()
Dim i As Integer
Dim FindStr As String
Dim RepStr As String
For i = 1 To 2
FindStr = Sheet2.Range("A" & i).Value
RepStr = Sheet2.Range("B" & i).Value
Sheet1.Cells.Replace What:=FindStr, Replacement:=RepStr
Next i
End Sub
Thank you.