Hi All,
Part of my code isn't working. I need to filter the data to a date specified by the user.
I can see dates in my data which match the exact date range that I input, but still it skips them.
I've built many filters before, but never tried to do this on date filters. Any ideas where I'm going wrong?
I tried recording macros using the filter "Date Filter", but couldn't see any nuances that jumped out at me.
Thanks in advance
Part of my code isn't working. I need to filter the data to a date specified by the user.
Code:
Sub Pomotions()
Dim Lastrow as Integer
Dim Daterange As Date
lastrow = Columns("A:A").Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
Daterange = InputBox("Please enter effective date (DD/MM/YYYY)")
Rows("1:1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$BL" & lastrow).AutoFilter Field:=4, Operator:= _
xlFilterValues, Criteria1:=Daterange
End Sub
I can see dates in my data which match the exact date range that I input, but still it skips them.
I've built many filters before, but never tried to do this on date filters. Any ideas where I'm going wrong?
I tried recording macros using the filter "Date Filter", but couldn't see any nuances that jumped out at me.
Thanks in advance