Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 204
Default Is my ListBox empty?

I have a (1-MultiSelectSingle) list box on a form and unfortunately I also
have two questions:

1. I want to check if I've put any entries in it (AddItem)

AND...

2. I want to check if the user has selected any items in the list box.

I've tried ListIndex = 0, but that is True if there are items in the list
and the user has selected the first one.

I'd Appreciate any pointers in the right direction. Thanks.

Michelle

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Is my ListBox empty?


if Listbox1.ListCount 0 then ' contains entries

idx = ListCount.Listindex

if idx = 0 then
' item number idx is selected
elseif idx = -1 then
' nothing is selected
End If

Regards,
Peter T

"Michelle" wrote in message
...
I have a (1-MultiSelectSingle) list box on a form and unfortunately I also
have two questions:

1. I want to check if I've put any entries in it (AddItem)

AND...

2. I want to check if the user has selected any items in the list box.

I've tried ListIndex = 0, but that is True if there are items in the list
and the user has selected the first one.

I'd Appreciate any pointers in the right direction. Thanks.

Michelle



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
getting error with empty listbox pswanie Excel Programming 0 June 8th 08 06:47 PM
empty listbox giving error pswanie Excel Programming 1 June 7th 08 04:18 PM
How to remove empty cells from Listbox Corey Excel Programming 4 May 11th 07 03:09 AM
listbox.value is empty even though there is data!!! lif[_7_] Excel Programming 1 July 2nd 06 11:47 PM
Empty listbox Derek Gadd[_2_] Excel Programming 3 February 11th 04 10:49 PM


All times are GMT +1. The time now is 03:25 AM.

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"