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: 2,510
Default Listbox no selection

Hi John,

If multiselect property set to single then following will tell you if a
selection is made.

Dim LstSelect As Variant

LstSelect = ListBox1.ListIndex

If LstSelect = -1 Then
MsgBox "No selection"
Else
MsgBox ListBox1.Value

End If

However, if multiselect property set to multi then

Dim x As Long
Dim numbSelected

For x = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(x) = True Then
numbSelected = numbSelected + 1
MsgBox ListBox1.List(x)
End If
Next x

If numbSelected = 0 Then
MsgBox "No Selections"

End If


--
Regards,

OssieMac


 
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 selection ub Excel Discussion (Misc queries) 0 March 10th 09 06:43 PM
Listbox & Selection sparx Excel Discussion (Misc queries) 0 July 31st 06 10:48 PM
Listbox selection Jonathan Excel Programming 4 July 27th 06 10:02 PM
Listbox Selection Help Matt[_38_] Excel Programming 1 March 9th 06 04:31 PM
ListBox selection GMet Excel Programming 1 September 24th 04 08:02 PM


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