gibbo1715
08-31-2005, 11:29 AM
Can anyone tell me how why the below doesnt work?
I want to display a message if my user selects more than one item from a userform listbox, I assume its because i ve put it into a loop and need to count items first? but not sure how to
For i = 0 To ListBox1.ListCount - 1
If i <> 1 then
msgbox " Please select one item only"
Exit sub
End if
If ListBox1.Selected(i) Then
MsgBox ListBox1.List(i, 0) & " is selected"
End If
Next
I want to display a message if my user selects more than one item from a userform listbox, I assume its because i ve put it into a loop and need to count items first? but not sure how to
For i = 0 To ListBox1.ListCount - 1
If i <> 1 then
msgbox " Please select one item only"
Exit sub
End if
If ListBox1.Selected(i) Then
MsgBox ListBox1.List(i, 0) & " is selected"
End If
Next