PDA

View Full Version : Solved: listbox selection



av8tordude
02-19-2011, 06:59 PM
I have listbox that displays info. What is the code that will determine if any item in the listbox is selected vs selecting an empty space?

mikerickson
02-19-2011, 07:51 PM
Something like
With ListBox1
If .ListIndex = -1 Then
MsgBox "nothing selected"
ElseIf .List(.ListIndex) = vbNullString Then
MsgBox "blank entry selected"
Else
MsgBox .List(.ListIndex) & " was selected."
End If
End With

av8tordude
02-19-2011, 07:57 PM
perfect...Thank you Mike:beerchug:

mikerickson
02-19-2011, 09:47 PM
Note the edit above.
If .ListIndex = -1 Then