April Parker
April Parker

Reputation: 111

VBA Combine values in 2 userform textboxes into a third textbox

I am having difficulty getting the value from textbox 1 and textbox 2 to combine and display in a textbox3 on a userform. Textbox1 and Textbox2 are locked, the values are dynamic and auto-filled from radio button controls. I have tried the following but it doesn't display the combined result in textbox3 and I think it's because the values in textbox 1 & 2 are the result of counter controls on the radio buttons. See image link.

Private Sub TextBox3_Change()
    textbox3.text=Textbox1.text & Textbox2.text
End Sub

enter image description here

Upvotes: 2

Views: 5791

Answers (2)

Lina
Lina

Reputation: 291

You could try to code below:

Private Sub TextBox2_Change()
   TextBox3.Value = TextBox1.text & TextBox2.text
End Sub

Hope that helps!

Upvotes: 0

GMalc
GMalc

Reputation: 2628

I found that the code below works best, your values will be combined. I placed a space between the values for s&g's.

Private Sub TextBox2_Change()
    Me.TextBox3.Value = Me.TextBox1.Value & " " + Me.TextBox2.Value
End Sub

Upvotes: 1

Related Questions