• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Excel Filter Between Two Dates On Userform & Sort Dates With ADO

kadrleyn

Member
In this template, I used Adodb.Connection and Adodb.Recordset to fill dates as unique into combo boxes and to sort dates oldest to newest .
The filtering results that created by selecting dates (first date-last date) from the combo boxes are listed in the listbox.

77046

Code:
For i = 2 To Sheets("Sheet1").Range("B" & Rows.Count).End(xlUp).Row
If CDate(Cells(i, "B").Value) >= CDate(ComboBox1.Value) And CDate(Cells(i, "B").Value) <= CDate(ComboBox2.Value) Then
With ListBox1
    .AddItem Cells(i, 1).Value
    .List(.ListCount - 1, 1) = Format(Cells(i, 2).Value, "dd.mm.yyyy")
    .List(.ListCount - 1, 2) = Cells(i, 3).Value
    .List(.ListCount - 1, 3) = Cells(i, 4).Value
    .List(.ListCount - 1, 4) = Cells(i, 5).Value
    .List(.ListCount - 1, 5) = Cells(i, 6).Value
    .List(.ListCount - 1, 6) = Format(Cells(i, 7).Value, "#,##0.00")
    .List(.ListCount - 1, 7) = Format(Cells(i, 8).Value, "#,##0.00")
End With
End If
Next i

Details & sample file link
 
Back
Top