Create list of selected items in MSForms listbox as string separated by | Or blank if none is selected.
You may also use ListBox_SelectionCount
Function ListBox_SelectedIndexes(LiBox As MSForms.Listbox, Optional Sepa="|")
' Returns list of selected items (ListIndex) from a listbox as string sperated with |
' Returns blank if none is selected
Rett = ""
For I = 1 To LiBox.ListCount
If LiBox.Selected(I - 1) Then
If Rett > "" Then Rett = Rett & Sepa
Rett = Rett & I - 1
End If
Next
ListBox_SelectedIndexes = Rett
End Function
' Returns list of selected items (ListIndex) from a listbox as string sperated with |
' Returns blank if none is selected
Rett = ""
For I = 1 To LiBox.ListCount
If LiBox.Selected(I - 1) Then
If Rett > "" Then Rett = Rett & Sepa
Rett = Rett & I - 1
End If
Next
ListBox_SelectedIndexes = Rett
End Function
LiBox, Optional Sepa
Views 4,569
Downloads 1,473
CodeID
DB ID
![](/Assets/UsersPics/userpic_3M62Ihum9O.jpg)
ANmarAmdeen
642
Revisions
v3.0
Thursday
April
21
2022
![](/Assets/img/_load903.gif)