Excel VBA UserForm Listbox Learn how to get selected item.
The source code used in this video:
Private Sub cbOK_Click()
If lbDays.ListIndex = -1 Then
MsgBox "Nothing selected"
Else
MsgBox "Selected item: " & lbDays.Value
End If
End Sub
Private Sub UserForm_Initialize()
With lbDays
.AddItem "Monday"
.AddItem "Tuesday"
.AddItem "Wednesday"
End With
End Sub