Option Explicit
Private Sub CommandButton1_Click()
Dim iCtr As Long
Dim oRow As Long
With Me.ListBox1
For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) Then
oRow = oRow + 1
Me.Cells(oRow, "B").Value = .List(iCtr)
End If
Next iCtr
End With
End Sub
I put the values in B1 and worked down the list:
me.cells(orow,"B").value = .list(ictr)
was the line.
oRow starts at 0 (I forgot to initialize it and an unitialized Long variable
will start at 0) but gets a 1 added whenever an item was selected. The next
time it finds a match, that oRow gets another 1 added to it (so it would be 2)
and B2 would get the value.
Did you really want to support multiple selections? If no, then the linked cell
should've worked ok.
And if this didn't help, where did you want the first value to go?
If you say E97, then change this line:
Me.Cells(oRow, "B").Value = .List(iCtr)
to
Me.Cells(oRow, "E").Value = .List(iCtr)
Add this line:
oRow = 96
(since the first thing we do is add one to it)
right before this line:
With Me.ListBox1
=====
It should look something like:
Option Explicit
Private Sub CommandButton1_Click()
Dim iCtr As Long
Dim oRow As Long
oRow = 96
With Me.ListBox1
For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) Then
oRow = oRow + 1
Me.Cells(oRow, "E").Value = .List(iCtr)
End If
Next iCtr
End With
End Sub