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

    Unanswered: Multi Select ListBox does not post 1 selection

    I thought this code was working ok, but 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

  2. #2
    Join Date
    Mar 2006
    Posts
    163
    Why do you have 10 in the for statement?

    That means you'll start at the 11th (because the listbox is zero-based) item.

  3. #3
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    Folowing on from norie's prompt I suspect you need this

    Code:
    Dim I As Long
    Dim X As Long
    X = 13
    For I = 0 To ListBox10.ListCount - 1
        If ListBox10.Selected(I) Then
            X = X + 1
            Range("M" & X) = ListBox10.List(I)
        End If
    Next I
    you probable had

    For I = 1 To ListBox10.ListCount - 1 ???

    HTH

    MTB

Posting Permissions

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