Hi
I have a data worksheet and am using autofilter vba code. I have the following criteria:
Code
Dim lDateTo As Long
Dim lDateFrom As Long
If IsDate(wsData.Range("A5")) Then
dFromDate = DateSerial(Year(dFromDate), Month(dFromDate), Day(dFromDate))
lDateFrom = dFromDate
dToDate = DateSerial(Year(dToDate), Month(dToDate), Day(dToDate))
lDateTo = dToDate
End If
wsData.Range("A1:N" & Cells(Rows.Count, "A").End(xlUp).Row).AutoFilter field:=1, Criteria1:=">=" & lDateFrom, Operator:=xlAnd, Criteria2:="<=" & lDateTo
wsData.Range("A2:N" & Cells(Rows.Count, "A").End(xlUp).Row).AutoFilter field:=15, Criteria1:="LIVE"
Display More
I have the above code but when i search for the date it always picks up the first date regardless but the rest of the filter is fine.
not sure why this is happening?
can someone please help
i have attached file. Data is the tab where the data is held. Masterproject has the filter button