![]() |
Multiselect Boxes
Hi All
I have a form setup with a multiselect box in it, and to determine which bits have been selected I am using multiselectbox.selected(listnumber) so effectively I loop through the list and ask eash member if it is selected. Unfortunately this does not seem to be working?? Is there something obvious that I am missing? Code fragment : for x = 0 to listcount if listbox.selected(x) then <do stuff end if next x Thanks heaps Jase |
Multiselect Boxes
Assume your listbox is named Listbox1 and this code is in the Userform code
module. Dim sStr as String Dim x as Long for x = 0 to Listbox1.listcount - 1 if listbox1.selected(x) then sStr = sStr & listbox1.list(x) & vbNewline end if next x msgbox sStr since the list is zero based, you need to loop to 1 less than listcount. -- Regards, Tom Ogilvy Jase wrote in message ... Hi All I have a form setup with a multiselect box in it, and to determine which bits have been selected I am using multiselectbox.selected(listnumber) so effectively I loop through the list and ask eash member if it is selected. Unfortunately this does not seem to be working?? Is there something obvious that I am missing? Code fragment : for x = 0 to listcount if listbox.selected(x) then <do stuff end if next x Thanks heaps Jase |
Multiselect Boxes
Hi Jase:
A few errors in your syntax, corrected below: Dim i As Integer For i = 0 To ListBox1.ListCount - 1 If ListBox1.Selected(i) Then Debug.Print ListBox1.List(i) End If Next i Regards, Vasant. "Jase" wrote in message ... Hi All I have a form setup with a multiselect box in it, and to determine which bits have been selected I am using multiselectbox.selected(listnumber) so effectively I loop through the list and ask eash member if it is selected. Unfortunately this does not seem to be working?? Is there something obvious that I am missing? Code fragment : for x = 0 to listcount if listbox.selected(x) then <do stuff end if next x Thanks heaps Jase |
All times are GMT +1. The time now is 11:12 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com