ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   multiselect listbox (https://www.excelbanter.com/excel-programming/286335-multiselect-listbox.html)

CG Rosén

multiselect listbox
 
Good Day Group,

What syntax to use to state that a MultiSelect
Listbox has no selection? To be used in the context:
If ListBox1 .....no selection.... Then etc...

Brgds

CG Rosén




Ron de Bruin

multiselect listbox
 
Try this

N = 0
For i = 0 To Userform1.ListBox1.ListCount - 1
If Userform1.ListBox1.Selected(i) = True Then
N = N + 1
End If
Next i
If N = 0 Then MsgBox "no selection"


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"CG Rosén" wrote in message ...
Good Day Group,

What syntax to use to state that a MultiSelect
Listbox has no selection? To be used in the context:
If ListBox1 .....no selection.... Then etc...

Brgds

CG Rosén






Tim Zych[_4_]

multiselect listbox
 
Listbox1.ListIndex = -1


"CG Rosén" wrote in message
...
Good Day Group,

What syntax to use to state that a MultiSelect
Listbox has no selection? To be used in the context:
If ListBox1 .....no selection.... Then etc...

Brgds

CG Rosén







All times are GMT +1. The time now is 09:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com