If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
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!
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
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