Michel Montreal
New Member
- Joined
- Feb 18, 2016
- Messages
- 1
Hello,
I was successfully using this Multiple Find & Replace code (which is on several websites) for the last 2 years at my job and now it's been a few weeks it doesn't work anymore.
I spent several hours researching a solution and trying a few tweaks but my knowledge in VBA is very little and I just don't get to get this code to work (nothing happens when I run the code, no error message). Can anyone please help me?
Basically, I have a column with company names (original range), where I need to find certain names and replace them there.
<tbody>
</tbody>
This is the code:
Thanks a lot!!!
I was successfully using this Multiple Find & Replace code (which is on several websites) for the last 2 years at my job and now it's been a few weeks it doesn't work anymore.
I spent several hours researching a solution and trying a few tweaks but my knowledge in VBA is very little and I just don't get to get this code to work (nothing happens when I run the code, no error message). Can anyone please help me?
Basically, I have a column with company names (original range), where I need to find certain names and replace them there.
Name (original range) | Find | Replace for | |
Sofa | Desk | Desktop | |
Table | Car | Truck | |
Desk | Sofa | Couch | |
Car | Table | Tablecloth |
<tbody>
</tbody>
This is the code:
Code:
Sub MultiFindNReplace()
'Update 20140722
Dim Rng As Range
Dim InputRng As Range, ReplaceRng As Range
xTitleId = "KutoolsforExcel"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Original Range", xTitleId, InputRng.Address, Type:=8)
Set ReplaceRng = Application.InputBox("Replace Range :", xTitleId, Type:=8)
Application.ScreenUpdating = False
For Each Rng In ReplaceRng.Columns(1).Cells
InputRng.Replace what:=Rng.Value, replacement:=Rng.Offset(0, 1).Value
Next
Application.ScreenUpdating = True
End Sub
Thanks a lot!!!