+ Reply to Thread
Results 1 to 4 of 4

Multi Selection in a ListBox

  1. #1
    Claus Mygind
    Guest

    Multi Selection in a ListBox

    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?



  2. #2
    Tom Ogilvy
    Guest

    Re: Multi Selection in a ListBox

    this control has supported the fmMultiSelectMulti since it (MSForms
    controls) was introduced in xl97. There should be no problem with using it.
    Perhaps if you show the code that you say doesn't work in xl2000.

    --
    Regards,
    Tom Ogilvy

    "Claus Mygind" <cmygind@tsccorp.com> wrote in message
    news:uiWGiSySFHA.3696@TK2MSFTNGP15.phx.gbl...
    > 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?
    >
    >




  3. #3
    Bob Phillips
    Guest

    Re: Multi Selection in a ListBox

    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" <cmygind@tsccorp.com> wrote in message
    news:uiWGiSySFHA.3696@TK2MSFTNGP15.phx.gbl...
    > 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?
    >
    >




  4. #4
    Claus Mygind
    Guest

    Re: 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" <phillips@tiscali.co.uk> wrote in message
    news:uRLh0yySFHA.1384@TK2MSFTNGP09.phx.gbl...
    > 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" <cmygind@tsccorp.com> wrote in message
    > news:uiWGiSySFHA.3696@TK2MSFTNGP15.phx.gbl...
    > > 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?
    > >
    > >

    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1