Hi Yasser,
Put this in your Userform code right under the unload code:
Private Sub CommandButton3_Click(): Dim i As Long, j As Long, ws As Worksheet, Z
If IsDate(UserForm1.TextDate1) And IsDate(UserForm1.TextDate2) Then
Set ws = ActiveSheet: SDate = CDate(UserForm1.TextDate1): EDate = CDate(UserForm1.TextDate2)
i = 2: Do Until ws.Cells(i, 2) = SDate: i = i + 1: Loop
j = ws.Range("B" & Rows.Count).End(xlUp).Row
Do Until ws.Cells(j, 2) <= EDate: j = j - 1: Loop
Z = ws.Range(Cells(i, 1), Cells(j, 2)): UserForm1.ListBox1.List = Z
Else
MsgBox "Please enter both dates"
End If: End Sub
Bookmarks