I was going to ask how to do this, but I think I worked it out all by myself So I thought I'd just check whether this is the most 'elegant' way of doing it?
I need to filter a range of records in my "AAA Complete Forecast" column that occur between 'today' and 10 days' time. I had some issues earlier with date formatting on filters, and found the dDate = format solution.
I need to filter a range of records in my "AAA Complete Forecast" column that occur between 'today' and 10 days' time. I had some issues earlier with date formatting on filters, and found the dDate = format solution.
Code:
''Set column to filter
Col1 = WorksheetFunction.Match("AAA Complete Forecast", Rows("1:1"), 0)
' set date format
dDate = Format(Date, "mm/dd/yyyy")
dDate10 = Format(Date + 10, "mm/dd/yyyy")
'Before Today
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=Col1, Criteria1:=">=" & dDate, Operator:=xlAnd, Criteria2:="<=" & dDate10