i have three text boxes
text1.text one line
text2.text one line
text3.text several lines
i need to search text3.text line by line
if i found one of the lines = text1.text then
replace this line with text2.text
Printable View
i have three text boxes
text1.text one line
text2.text one line
text3.text several lines
i need to search text3.text line by line
if i found one of the lines = text1.text then
replace this line with text2.text
VB Code:
Option Explicit Private Sub Command1_Click() Dim linesArr() As String linesArr() = Split(Text3.Text, vbCrLf) Dim i As Integer For i = 0 To UBound(linesArr) If Trim(linesArr(i)) = Trim(Text1.Text) Then linesArr(i) = Trim(Text2.Text) End If Next i Text3.Text = Join(linesArr, vbCrLf) End Sub
Text3.Text = Mid(Replace(vbCrLf & Text3.Text, vbCrLf & Text1.Text, vbCrLf & Text2.Text, vbTextCompare), 3)
leinad31 thank you very much this is what i need :bigyello:
thanks alot gavio :wave: