I have a user form that contains list box. I want to be able to select multiple items from my list box and when I click the "OK" command button in the user form, I want the items selected to be transferred to another worksheet in the same workbook. I have attempted a code but my code only enabled the last item selected to be transferred. I want all items selected to be transferred.
Here is my code:
Dim i
With Sheet5
.Cells(newRow, 5) = ListBox1
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
.Cells(newRow, 5) = ListBox1.List(i)
End If
Next i
End With
Here is my code:
Dim i
With Sheet5
.Cells(newRow, 5) = ListBox1
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
.Cells(newRow, 5) = ListBox1.List(i)
End If
Next i
End With