Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
can I have a multiselect option for a list box in excel 2003 | Excel Discussion (Misc queries) | |||
How do I create a multiselect drop down list | Excel Worksheet Functions | |||
Multiselect Validation (dropdown) | Excel Discussion (Misc queries) | |||
Data validation boxes, outputting a final number from the boxes | Excel Discussion (Misc queries) | |||
Multiselect Listbox use | Excel Discussion (Misc queries) |