View Full Version : Multi-choice of the listbox to many controls(textbox)

12-16-2016, 01:02 PM
hi all
Can transfer, multi-choice of a listbox to me.controls("I") (24 textbox)
In other words textbox1= listbox.value+listbox.value+listbox.value+listbox.value
The result of their appearance in textbox (en+sr+1+dd)

Leith Ross
12-16-2016, 01:22 PM
Hello mido21,

This code worked for me.

UserForm1 Code

Private Sub ListBox1_Change()

Dim a As Integer

a = ListBox1.ListIndex

For d = 1 To 23
If Me.Controls("i" & d).Text = "" Then
Me.Controls("i" & d).Text = CStr(ListBox1.List(a))
Me.Controls("i" & d).Text = Me.Controls("i" & d).Text + "," + CStr(ListBox1.List(a))
End If
Next d

End Sub

Private Sub UserForm_Initialize()
ListBox1.List = Sheets("data").Range("a2:a20").Value
End Sub

12-16-2016, 01:47 PM
hello Leith Ross
The code works correctly on each it is worth all controls once one
I want the code is a single one

Leith Ross
12-16-2016, 02:59 PM
Hello mido21,

Sorry, I don't understand. Can you provide an example?

12-16-2016, 11:03 PM
hello Leith Ross
The code now write in all controls("I") textbox - In the selection of listbox
But what I need is registration in the i1 and i2 and i3
I thought I enter code within the comndbotton