Hello Experts,
I have been trying to send the UserForm listbox's selected items in the worksheet horizontally.
I don't understand why I cant fill and send data to the next blank rows.
its always overwriting the existing data. I have tried adding plus 1 row too.
please see code below. much thanks.
reggieneo
I have been trying to send the UserForm listbox's selected items in the worksheet horizontally.
I don't understand why I cant fill and send data to the next blank rows.
its always overwriting the existing data. I have tried adding plus 1 row too.
please see code below. much thanks.
Code:
Dim lItem As Long
Dim Col As Integer
Col = 35
Dim sht As Worksheet
Dim LastRow As Long
Stop
Set sht = ActiveSheet
For lItem = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(lItem) = True Then
LastRow = sht.Cells(sht.Rows.Count, Col).End(xlUp).Row + 1
Sheet135.Cells(LastRow + 1, Col).End(xlUp).Value = ListBox1.List(lItem)
ListBox1.Selected(lItem) = False
Col = Col + 1
End If
Next
Unload Me
End Sub
Last edited by a moderator: