Listbox no selection

J

John

How do I tell when no selection has been made when a user has clicked OK on
my UserForm that contains text and list boxes? I get the text box input and
the listbox selections fine, but none of the following tests identify when
the user fails to select anything in the list box.
If IsEmpty(InAIOwner) Then MsgBox "..."
If Len(InAIOwner) = 0Then MsgBox "..."
If InAIOwner = "" Then MsgBox "..."
How do I test for no selection?

I appreciate your help, -John
 
H

Harald Staff

Hi John

If nothing is selscted then the ListIndex property is less than zero. Zero
is the first item in the list.

HTH. Best wishes Harald
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top