+ Reply to Thread
Results 1 to 3 of 3

Selecting multiple items on Listbox

  1. #1
    Registered User
    Join Date
    04-20-2006
    Posts
    2

    Selecting multiple items on Listbox

    Hi,

    I am new to MS Excel and need help with the selection of multiple items on a Listbox (using the Control Toolbox). I have managed to set up a listbox and it allows me to select more than one item (using Multiselect in Properties).

    I want to output my selections to cells in my worksheet. So if I select two items from my listbox I will have the values for those items in Cells: A1 and A2. Essentially I would like a Linkedcell functionality for multiple selections and not just single selections.

    Can anyone help with this.

    Thanks

    Rahul

  2. #2
    Bob Phillips
    Guest

    Re: Selecting multiple items on Listbox

    Private Sub ListBox1_Change()
    Dim i As Long
    Dim j As Long
    With Me.ListBox1
    For i = 0 To .ListCount - 1
    If .Selected(i) Then
    j = j + 1
    Cells(j, "A").Value = .List(i)
    End If
    Next i
    End With
    End Sub

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "Rahul_Uk" <Rahul_Uk.26kl9m_1145548508.9362@excelforum-nospam.com> wrote in
    message news:Rahul_Uk.26kl9m_1145548508.9362@excelforum-nospam.com...
    >
    > Hi,
    >
    > I am new to MS Excel and need help with the selection of multiple items
    > on a Listbox (using the Control Toolbox). I have managed to set up a
    > listbox and it allows me to select more than one item (using
    > Multiselect in Properties).
    >
    > I want to output my selections to cells in my worksheet. So if I
    > select two items from my listbox I will have the values for those items
    > in Cells: A1 and A2. Essentially I would like a Linkedcell
    > functionality for multiple selections and not just single selections.
    >
    > Can anyone help with this.
    >
    > Thanks
    >
    > Rahul
    >
    >
    > --
    > Rahul_Uk
    > ------------------------------------------------------------------------
    > Rahul_Uk's Profile:

    http://www.excelforum.com/member.php...o&userid=33690
    > View this thread: http://www.excelforum.com/showthread...hreadid=534632
    >




  3. #3
    Registered User
    Join Date
    04-20-2006
    Posts
    2

    Only one of the items is being returned

    Thanks for the quick response...your help is much appreciated.

    I still have the following problems unfortunately.

    1. The code worked initially populating Cell A1 with my selection. But it does not work anymore.

    2. When it did work it only managed to populate cell A1 with the first item selected but did not populate A2 or A3 with the second and third items selected from the Listbox.

+ 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