Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default multiselect remove

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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default multiselect remove

Yup, It worked.

Thanks Tom.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default multiselect remove

Yup, It worked.

Thanks Tom.

Reply
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
Multiselect Listbox use RKS Excel Discussion (Misc queries) 1 May 12th 06 03:04 PM
MultiSelect ListBox StephanieH Excel Programming 5 November 20th 04 12:29 AM
Multiselect Listbox Francis Ang[_3_] Excel Programming 0 October 27th 04 02:21 AM
Multiselect Listbox Francis Ang[_3_] Excel Programming 2 October 25th 04 01:57 AM
multiselect listbox CG Rosén Excel Programming 2 December 28th 03 05:17 PM


All times are GMT +1. The time now is 01:07 AM.

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"