Hi
I want to filter records that lie in between dates, with startDate & endDate cells F1 & H1, Data is in A2:E2000, Date in just wondered if I could input the dates in a dialog (do away with F1& H1), also make the range dynamic
My Code
I want to filter records that lie in between dates, with startDate & endDate cells F1 & H1, Data is in A2:E2000, Date in just wondered if I could input the dates in a dialog (do away with F1& H1), also make the range dynamic
My Code
VBA Code:
Sub MyDateFilter()
Dim lngStart As Long, lngEnd As Long
lngStart = Range("F1").Value 'start date
lngEnd = Range("H1").Value 'end date
Range("A1:A2000").AutoFilter field:=1, _
Criteria1:=">=" & lngStart, _
Operator:=xlAnd, _
Criteria2:="<=" & lngEnd
End Sub