hello
I need help about this code to filter between two dates I would add condition if the k2,l2 are empty then show all the data
thanks in advance
I need help about this code to filter between two dates I would add condition if the k2,l2 are empty then show all the data
VBA Code:
Sub ff()
Dim StartDate As Date
Dim EndDate As Date
StartDate = Range("k2").Value
EndDate = Range("l2").Value
ActiveSheet.Range("A1:h1").AutoFilter Field:=1, Criteria1:=">=" & CDbl(StartDate), Operator:=xlAnd, Criteria2:="<=" & CDbl(EndDate)
End Sub