Hi there, i have a big question...
My code that i use perfectly removes the extra spaces, but there is a problem.
For Example:
Textbox1: Hi world !
Textbox2: Hello There !
Textbox3: Nice !
when i execute this code, it removes the spaces perfectly, but it changes the textboxes texts to the same as Textbox3:
Textbox1: Nice!
Textbox2: Nice!
Textbox3: Nice!
What could be causing this?
My Code:
My code that i use perfectly removes the extra spaces, but there is a problem.
For Example:
Textbox1: Hi world !
Textbox2: Hello There !
Textbox3: Nice !
when i execute this code, it removes the spaces perfectly, but it changes the textboxes texts to the same as Textbox3:
Textbox1: Nice!
Textbox2: Nice!
Textbox3: Nice!
What could be causing this?
My Code:
Code:
Dim x As Long
Dim i As Integer
Dim tex() As String
For x = 1 To 10 'change to how many you think
TextBox1.Text = Replace(TextBox1.Text, " ", " ") '
TextBox2.Text = Replace(TextBox2.Text, " ", " ")
TextBox3.Text = Replace(TextBox3.Text, " ", " ")
Next x
tex = Split(TextBox1.Text, vbCrLf)
tex = Split(TextBox2.Text, vbCrLf)
tex = Split(TextBox3.Text, vbCrLf)
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
For i = LBound(tex) To UBound(tex)
TextBox1.Text = TextBox1.Text & " " & tex(i)
TextBox2.Text = TextBox2.Text & " " & tex(i)
TextBox3.Text = TextBox3.Text & " " & tex(i)
Next i
TextBox1.Text = Mid(TextBox1.Text, 2)
TextBox2.Text = Mid(TextBox2.Text, 2)
TextBox3.Text = Mid(TextBox3.Text, 2)
End Sub