Listbox no selection
Hi John,
If multiselect property set to single then following will tell you if a
selection is made.
Dim LstSelect As Variant
LstSelect = ListBox1.ListIndex
If LstSelect = -1 Then
MsgBox "No selection"
Else
MsgBox ListBox1.Value
End If
However, if multiselect property set to multi then
Dim x As Long
Dim numbSelected
For x = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(x) = True Then
numbSelected = numbSelected + 1
MsgBox ListBox1.List(x)
End If
Next x
If numbSelected = 0 Then
MsgBox "No Selections"
End If
--
Regards,
OssieMac
|