I have a multicolumn listbox in my userform and I would like to get all the values of the elements which are in the selected row in the listbox.
Here is my userform:
It's a 6column list box and the 3rd column would be the multiplier hence the "(x)". You may also rearrange the list to how you like it.
Private Function selList() As String
Dim i As Long
For i =LBound(lstListBox1.List) To UBound(lstListBox1.List)
If lstListBox1.Selected(i) Then
selList = selList & lstListBox1.List(i) & " " & lstListBox1.List(i, 1) _
& "(x" & lstListBox1.List(i, 3) & ")" & " " & lstListBox1.List(i, 2) & " " & lstListBox1.List(i, 4) & ", "
End If
Next i
If selList= "" Then
selList= ""
Else
selList= Left(selList, Len(selList) - 2)
End If
MsgBox selList
End Function