Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can anyone please tell me how to check that the user has made a selection in
a VBA ListBox - I need to warn them if no selection has been made Thanks TAM |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If no item has been selected in the listbox, the ListIndex
property will be -1. E.g., If Me.ListBox1.ListIndex = -1 Then MsgBox "You must select an item" End If -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "TAM" wrote in message t... Can anyone please tell me how to check that the user has made a selection in a VBA ListBox - I need to warn them if no selection has been made Thanks TAM |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is some code for a userform listbox
Dim i As Long Dim fSelected As Boolean fSelected = False With Me.ListBox1 For i = 1 To .ListCount If .Selected(i) Then fSelected = True Exit For End If Next i End With If Not fSelected Then MsgBox "Nothing selected" End If -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "TAM" wrote in message t... Can anyone please tell me how to check that the user has made a selection in a VBA ListBox - I need to warn them if no selection has been made Thanks TAM |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Many thanks for your help
"TAM" wrote in message t... Can anyone please tell me how to check that the user has made a selection in a VBA ListBox - I need to warn them if no selection has been made Thanks TAM |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Check the ListIndex property. It will be -1 if no selection has been
made. For more, check the VBA help. -- Regards, Tushar Mehta www.tushar-mehta.com Excel, PowerPoint, and VBA add-ins, tutorials Custom MS Office productivity solutions In article , says... Can anyone please tell me how to check that the user has made a selection in a VBA ListBox - I need to warn them if no selection has been made Thanks TAM |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
listbox B conditional of input in Listbox A | Excel Discussion (Misc queries) | |||
Listbox B if LIstbox A equals | Excel Discussion (Misc queries) | |||
listbox.value not equal to listbox.list(listbox.listindex,0) | Excel Programming | |||
Is refreshing listbox rowsource in listbox click event possible? | Excel Programming | |||
Sorting ListBox results or transposing ListBox values to other cells for sorting | Excel Programming |