Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2005
    Posts
    13

    Unanswered: Place Data from MultiSelect Listbox

    I am having a brain lapse, apparently... I want to simply place a list of data selected from a multi select listbox, that is run in a VBA form, in a spreadsheet. I will then do a lookup to pull additional data from that list. HELP!

    THANK YOU!

    Keith

  2. #2
    Join Date
    Mar 2006
    Posts
    163
    Keith

    Is it on a userform?

    Where do you want to put the data?
    Code:
    Private Sub CommandButton1_Click()
    Dim I As Long
    Dim X As Long
        For I = 0 To ListBox1.ListCount - 1
            If ListBox1.Selected(I) Then
                X = X + 1
                Range("B" & X) = ListBox1.List(I)
            End If
        Next I
    End Sub

  3. #3
    Join Date
    Mar 2005
    Posts
    13
    I just want to put it in sheet1, column A, Row 1 then 2, etc.

  4. #4
    Join Date
    Mar 2006
    Posts
    163
    Well just chnage B to A in the code I posted.

  5. #5
    Join Date
    Mar 2005
    Posts
    13
    Actually, I really want it to go start in row 14... which variable do I change for that? Thanks so much for your help already!

  6. #6
    Join Date
    Mar 2006
    Posts
    163
    Just put X = 13 before the loop.

  7. #7
    Join Date
    Mar 2005
    Posts
    13
    That works great so far, or so I thought. I just realized that if I select one item or a list of items, the first one is not listed. What am I missing? Here's my code:

    Dim I As Long
    Dim X As Long
    X = 13
    For I = 10 To ListBox10.ListCount - 1
    If ListBox10.Selected(I) Then

    X = X + 1
    Range("M" & X) = ListBox10.List(I)
    End If
    Next I

Posting Permissions

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