hi, i have a userform for data entry. Users will populate the data in the userform and click the commandbutton1. The issue i have is with the "tables used" "time range" and "helper" listbox where users can select multiple selections. What i want to achieve is that each of the multi selection should populate in columns and not in the next row. The code i have as of now is a bit off. When i select 8:00 and 9:00 in the time range, it populates with a blank column in between. I am guessing it is also taking into account 8:30 which was not selected.
For w = 0 To Me.ListBox3.ListCount - 1
If Me.ListBox3.Selected(w) = True Then
Set ws2 = Worksheets(Me.ListBox3.List(w))
lRow2 = ws2.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row
v = 2
With ws2
For x = 0 To Me.ListBox4.ListCount - 1
For y = 0 To Me.ListBox5.ListCount - 1
If Me.ListBox4.Selected(x) = True Then
v = v
If Me.ListBox5.Selected(y) = True Then
If IsDate(TextBox3.Value) Then
.Cells(lRow2, 1).Value = CDate(TextBox3.Value)
End If
.Cells(lRow2, v).Value = Me.ListBox4.List(x)
' .Cells(lRow2, 4).Value = ws1.Cells(lRow1, 1).Value
' .Cells(lRow2, 5).Value = Me.ListBox4.List(y)
End If
End If
Next y
v = v + 1
Next x
End With
End If
Next w
Can anyone please help me with this? Have also attached the workbook for your reference
Bookmarks