I'm trying to sort an Excel worksheet by date range using VBA. I need to filter for all entries that are within a week of the current date.
The worksheet is arranged into columns (A to S). Column 'I' stores the dates I want filtered.
Below is the latest code i've tried (i've tried a few variations... and just cant figure it out).
Dim A As Date
Dim b As String
Dim c As Long
A = Date
A = DateSerial(Year(A), Month(A), Day(A))
b = Format(A - 7, "yyyy, mm, dd")
c = b
With ActiveSheet
.Range("$A:$S").AutoFilter Field:=9, Criteria:=">" & c
End With
Thanks in advance for your help with this.
GTD