W
Webtechie
Hello,
I have one multi-select two column listbox on a userform. I have a button
that will take the selection from the mult-select listbox that has two
columns to another listbox that also has two columns.
Here is my code:
Dim itemIndex As Integer
Dim myVar As Variant
With frmEmployeeMaintenance
.lstClubsAssigned.RowSource = "" 'second listbox
If .lstClubs.ListIndex = -1 Then 'first listbox
Exit Sub
End If
For itemIndex = .lstClubs.ListCount - 1 To 0 Step -1
If .lstClubs.Selected(itemIndex) Then
.lstClubsAssigned.AddItem .lstClubs.Column(0, itemIndex) &
";" & .lstClubs.Column(1, itemIndex)
End If
Next itemIndex
End With
I found this code on a help forum, but it is not working for me. It only
adds a concatenated string to the first column. How do I add values to both
columns?
Thanks,
Tony
I have one multi-select two column listbox on a userform. I have a button
that will take the selection from the mult-select listbox that has two
columns to another listbox that also has two columns.
Here is my code:
Dim itemIndex As Integer
Dim myVar As Variant
With frmEmployeeMaintenance
.lstClubsAssigned.RowSource = "" 'second listbox
If .lstClubs.ListIndex = -1 Then 'first listbox
Exit Sub
End If
For itemIndex = .lstClubs.ListCount - 1 To 0 Step -1
If .lstClubs.Selected(itemIndex) Then
.lstClubsAssigned.AddItem .lstClubs.Column(0, itemIndex) &
";" & .lstClubs.Column(1, itemIndex)
End If
Next itemIndex
End With
I found this code on a help forum, but it is not working for me. It only
adds a concatenated string to the first column. How do I add values to both
columns?
Thanks,
Tony