View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default multiselect remove


Loop from highest to lowest.

For i = SelectListBox.ListCount - 1 to 0 Step -1
If SelectListBox.Selected(i) = True Then
SelectListBox.RemoveItem (i)
End If
Next


--
Regards,
Tom Ogilvy

"King" wrote in message
oups.com...
Hi,

I am using mulitselect listbox. when user clicks remove button, i want
to remove all the selected items from multiselect listbox in a single
shot. i used folloing code, but it is throwing an error "Could not get
selected property, invalid arguments",

For i = 0 To SelectListBox.ListCount - 1
If SelectListBox.Selected(i) = True Then
SelectListBox.RemoveItem (i)
End If
Next

any help?

thanks,

King.