LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Multiselect listbox if no selection

Hi All,

I have a listbox that is multiselect. I want to find a way to figure out if
anything is selected, if not "do something". I wrote this which works, but I
have to think that there is an easier way.

Dim Z As Integer
Z = 0
With lst_Comp_Lv
For i = 0 To .ListCount - 1
If .Selected(i) Then
Else
Z = Z + 1
End If
Next i
End With

If Z = lst_Comp_Lv.ListCount Then
MsgBox "There was nothing selected."
Exit Sub
End If

I also tried:

If lst_Comp_Lv = Null Then
MsgBox "There is nothing selected."
Exit Sub
End If

But that didn't work.

Any suggestions or advice you could provide would be greatly appreciated.
Thank you.

 
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
Problem with multiselect listbox items selection [email protected] Excel Programming 2 October 6th 07 11:16 PM
change combobox values one by one based on selection in multiselect listbox Abdul[_2_] Excel Programming 0 November 7th 06 11:55 AM
Last Selection from MultiSelect Listbox Brian Excel Programming 4 December 3rd 05 07:13 AM
Multiselect Listbox Francis Ang[_3_] Excel Programming 2 October 25th 04 01:57 AM
Multiselect listbox selection question Paul Mueller Excel Programming 3 June 16th 04 09:25 PM


All times are GMT +1. The time now is 02:47 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"