hardwired
04-03-2008, 02:24 AM
Hi,
I know that this is a simple one but i'm simple, so help me, lol..
I want to trap error for if nothing has been selected in a listbox (its set to multiselect btw, just in case that matters)..
I tried this:
If LayoutLIST.ListIndex = -1 Then
MsgBox "No, its not selected"
Exit Sub
End If
...as a test but it didn't seem to work (saw that code somewhere online - not the msgbox bit)..
I know that the listbox in VBA is an MSForms listbox not a native VB one, so has different properties and all the info i've found online on how to do this doesn't work, so was wondering if someone on here knew what to do..
I know that this is a simple one but i'm simple, so help me, lol..
I want to trap error for if nothing has been selected in a listbox (its set to multiselect btw, just in case that matters)..
I tried this:
If LayoutLIST.ListIndex = -1 Then
MsgBox "No, its not selected"
Exit Sub
End If
...as a test but it didn't seem to work (saw that code somewhere online - not the msgbox bit)..
I know that the listbox in VBA is an MSForms listbox not a native VB one, so has different properties and all the info i've found online on how to do this doesn't work, so was wondering if someone on here knew what to do..