Hello,
I am using a macro to find & replace, but it work only when the cell has the value itself. I need the replace when he value contains in the cell, e.g.
My knowledge in vba is almost null, please help me
1a = X
A1 |A1
1atext should look like after replacement |Xtext
1btext ----> |Xtext
1ctext |Xtext
Thanks
edit: holy I messed everything up
1a = X
1b = Y
1c = Z
A1
1atext
1btext
1ctext
After replacement...
A1
Xtext
Ytext
Ztext
I am using a macro to find & replace, but it work only when the cell has the value itself. I need the replace when he value contains in the cell, e.g.
My knowledge in vba is almost null, please help me
1a = X
A1 |A1
1atext should look like after replacement |Xtext
1btext ----> |Xtext
1ctext |Xtext
Code:
Sub multisubstituir()On Error Resume Next
Dim myList, myRange
Set myList = Application.InputBox(prompt:="Select the modifications (2 columns)", _
Title:="Tabela das Substituições", Type:=8)
Set myRange = Application.InputBox(prompt:="Select the cells to replace", _
Title:="Área a Substituir", Type:=8)
For Each cel In myList.Columns(1).Cells
myRange.Replace What:=cel.Value, _
replacement:=cel.Offset(0, 1).Value, LookAt:=xlWhole
Next cel
End Sub
Thanks
edit: holy I messed everything up
1a = X
1b = Y
1c = Z
A1
1atext
1btext
1ctext
After replacement...
A1
Xtext
Ytext
Ztext
Last edited by a moderator: