View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Claus Mygind Claus Mygind is offline
external usenet poster
 
Posts: 2
Default Multi Selection in a ListBox

Bob,
Thanks. As you can see by my code I was doing that.

My Code:
For i = 0 To cLastRow
If myListBox.Selected(i) = True Then

However all values whether selected or not returned a "False" value. I
recoded the data source for the listBox and that seemed to solve the
problem.

From This:
' UserForm1.ListBox1.RowSource = cPickList

To This:
wkLastRow = Mid(cPickTable, InStr(1, cPickTable, "H$", 1) + 2)
Range("AD4").Select
While wkLastRow = ActiveCell.Row

UserForm1.ListBox1.AddItem (ActiveCell.Value)
Application.Goto REFERENCE:="R[1]C"

Wend



"Bob Phillips" wrote in message
...
You have to check all items like so

Dim i As Long
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
Debug.Print ListBox1.List(i)
End If
Next i


--
HTH

Bob Phillips

"Claus Mygind" wrote in message
...
I have written an app in excel version 2002 with SP-1
installed. It contains a userform with a listbox.
The "MultiSelect" property is set to
1-fmMultiSelectMulti. This works fine with this version
and higher. But when I run the app on version 2000, the
selected items do not return a value of "True". However
if I reset the property to 0-fmMultiSelectSingle it works
fine.

How can I overcome this problem?