Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Test for no listbox selection

I have a userform w/ a listbox that has a few items. How do I test to be
sure at least one item is selected when OK is clicked. None of the following
will display the MsgBox to find the omision of listbox selection:
If Len(Listbox1) = 0 Then MsgBox "..."
If IsEmpty(Listbox1) Then MsgBox "..."
If Listbox1 = "" Then MsgBox "..."
How do I tell if no selection has been made?

I appreciate your help, -John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Test for no listbox selection

The ListIndex property of the ListBox will be -1 (minus one).

--
Rick (MVP - Excel)


"John" wrote in message
...
I have a userform w/ a listbox that has a few items. How do I test to be
sure at least one item is selected when OK is clicked. None of the
following
will display the MsgBox to find the omision of listbox selection:
If Len(Listbox1) = 0 Then MsgBox "..."
If IsEmpty(Listbox1) Then MsgBox "..."
If Listbox1 = "" Then MsgBox "..."
How do I tell if no selection has been made?

I appreciate your help, -John


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Listbox no selection John Excel Programming 1 February 7th 09 05:37 AM
Listbox Selection melissa Excel Programming 2 August 14th 07 01:53 PM
Test for an empty selection Edward Ulle Excel Programming 4 September 8th 05 02:54 PM
ListBox selection GMet Excel Programming 1 September 24th 04 08:02 PM
test vba in listbox (UF) Mark[_17_] Excel Programming 1 June 14th 04 12:41 PM


All times are GMT +1. The time now is 01:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"