peterwmartin
03-27-2013, 01:56 PM
Hi all,
need help with writing multiselected values in a listbox to a userform text box. Have multi select working however it is only writing 1 value
eg
name1
name2
name3
name4
to a textbox as name1, name3, name4
this is a variation of what I had, however this only puts the first name on the list in the text box.
A previous version put the first selected name now im lost
Private Sub CommandButton1_Click()
Dim Item As Long
Item = 1
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
UserForm1.TextBox4 = ListBox1.List(lItem)
ListBox1.Selected(Item) = False
End If
Next i
End Sub
Cheers
need help with writing multiselected values in a listbox to a userform text box. Have multi select working however it is only writing 1 value
eg
name1
name2
name3
name4
to a textbox as name1, name3, name4
this is a variation of what I had, however this only puts the first name on the list in the text box.
A previous version put the first selected name now im lost
Private Sub CommandButton1_Click()
Dim Item As Long
Item = 1
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
UserForm1.TextBox4 = ListBox1.List(lItem)
ListBox1.Selected(Item) = False
End If
Next i
End Sub
Cheers