Hi All
I am trying write code to filter for all data before today's date which is contained in a cell. I assumed that it would be pretty basic and that filtering using the "<" symbol would work. It works for standard numbers, but dates don't seem to like it. The filter determines that there are no results prior to the requested date. Just as a test, I also tried using the ">" symbol for dates after today and it returned all the results that had only text in the date field. What am I missing?
Here's the code I am using (2003 Excel).
I am trying write code to filter for all data before today's date which is contained in a cell. I assumed that it would be pretty basic and that filtering using the "<" symbol would work. It works for standard numbers, but dates don't seem to like it. The filter determines that there are no results prior to the requested date. Just as a test, I also tried using the ">" symbol for dates after today and it returned all the results that had only text in the date field. What am I missing?
Here's the code I am using (2003 Excel).
Code:
Sub FilterExpiryDate()
Selection.AutoFilter Field:=9, Criteria1:="<" & Range("A1").Value, Operator:=xlAnd
Range("C7").Select
End Sub