Hello
Below is the code to execute multiple different finds and replacing the same in Textbox with Single String or Character at one go but some how could not succeed
for eg if txtSearchFor.Text = "MrExcel-Thread*1111"
so after executing the above code i get below result as after incorporating the value "#" in combobox
txtReplace.Text = "MrExcel-Thread#1111" instead of "MrExcel#Thread#1111"
Any possibilities for multiple finds and replacing same with Single String or character at One go in a textbox using the above loop
NimishK
Below is the code to execute multiple different finds and replacing the same in Textbox with Single String or Character at one go but some how could not succeed
VBA Code:
Sub MultiReplacements()
Dim arrayAsciichar() As Variant, i As Long
arrayAsciichar = Array("-", "_", ":", " ", "#", "$", "*")
For i = LBound(arrayAsciichar) To UBound(arrayAsciichar)
If InStr(txtSearchFor.Text, arrayAsciichar(i)) > 0 Then
txtReplace.Text = Replace(txtSearchFor.Text, arrayAsciichar(i), cmbInsertChars.Text)
End If
Next i
End Sub
so after executing the above code i get below result as after incorporating the value "#" in combobox
txtReplace.Text = "MrExcel-Thread#1111" instead of "MrExcel#Thread#1111"
Any possibilities for multiple finds and replacing same with Single String or character at One go in a textbox using the above loop
NimishK
Last edited: