(Solved) – Filter data using datepicker from excel sheet to listbox in userform


I have been trying to create a excel macro in which,I get the user input from form1 to excel sheet1 and using form2 to get the data from sheet1 by using date-picker and a combo Box to a list box. I followed a tutorial and came up with this , I doesn’t show any error output to the Listbox.
P.S I haven’t fully completed the instruction from tutorial but the code doesn’t run till I have done it. I’m lost in between I can’t move onto next steps

Private Sub DTPicker2_CloseUp()
Dim i As Long
For i = 2 To Sheet1.Range("I100000").End(xlUp).Offset(1, 0).Row
If Sheet1.Cells(i, "A").Value = Me.ComboBox1.Value And Sheet1.Cells(i, "I").Value >= _
Me.DTPicker1.Value And Sheet1.Cells(i, "I").Value <= Me.DTPicker2.Value Then
Me.ListBox1.AddItem Sheet1.Cells(i, 1).Value
End If
Next i

End Sub

The excel file

Leave a Reply

Your email address will not be published. Required fields are marked *