Hi folks
I have a userform with a list box (called 'DidShow'), populated without any problems from an existing worksheet with names of potential attendees at training course.
The list box is set to 1 - fmMultiSelectMulti to enable the user to select any number of the available names in the list.
I have the below code, which will drop the first selected name into row 2 of column X on a sheet called "Workings" - correctly.
The code then cycles through to the end (up to 50 names) but at no point goes into the If statement (If DidShow.Selected(lngItem) Then) to add any additionally selected names into column X as required.
When multiple items are selected, they are highlighted blue on the user form, but as soon as the first selected name is added to column X all others are then deselected - is this causing the fact that no further names are added to column X? If so, how do I keep that focus on selected names so they populate the required area?
Any pointers greatly appreciated - I have been trying to sort this out for weeks!!
Cheers in advance!!
Dim lngItem As Long
For lngItem = 0 To DidShow.ListCount - 1
If DidShow.Selected(lngItem) Then
With Sheets("Workings")
.Cells(.Rows.Count, "X").End(xlUp).Offset(1).value = DidShow.List(lngItem)
End With
End If
Next lngItem
I have a userform with a list box (called 'DidShow'), populated without any problems from an existing worksheet with names of potential attendees at training course.
The list box is set to 1 - fmMultiSelectMulti to enable the user to select any number of the available names in the list.
I have the below code, which will drop the first selected name into row 2 of column X on a sheet called "Workings" - correctly.
The code then cycles through to the end (up to 50 names) but at no point goes into the If statement (If DidShow.Selected(lngItem) Then) to add any additionally selected names into column X as required.
When multiple items are selected, they are highlighted blue on the user form, but as soon as the first selected name is added to column X all others are then deselected - is this causing the fact that no further names are added to column X? If so, how do I keep that focus on selected names so they populate the required area?
Any pointers greatly appreciated - I have been trying to sort this out for weeks!!
Cheers in advance!!
Dim lngItem As Long
For lngItem = 0 To DidShow.ListCount - 1
If DidShow.Selected(lngItem) Then
With Sheets("Workings")
.Cells(.Rows.Count, "X").End(xlUp).Offset(1).value = DidShow.List(lngItem)
End With
End If
Next lngItem