I am trying to create a button that will filter a table and delete row entries that are more than two days a head (i.e. today is Monday and I want to delete rows that have a date past the coming Wednesday).
The date column is in column A and I have D2 is "=Today()"
I am getting the "Run-Time error '1004': Unable to get the Workday property of the WorksheetFunction class". Please help.
Here is my code:
The date column is in column A and I have D2 is "=Today()"
I am getting the "Run-Time error '1004': Unable to get the Workday property of the WorksheetFunction class". Please help.
Here is my code:
VBA Code:
Sub Datefilter()
Dim MyVal As Date
Dim ORTable As ListObject
MyVal = Application.WorksheetFunction.WorkDay(Range("D2").Value, -2)
Worksheets("Open Report").Range("A11:A9999").AutoFilter Field:=1, Criteria1:="<=" & MyVal
End Sub