Reputation:
I have a column in a table that contains blanks and dates. How do I code in VBA the option to exclude blanks and dates in the future?
Upvotes: 0
Views: 167
Reputation: 3259
This should filter out the blanks and future dates.
Note that it will only filter these out of the columns that you specify as Field
(based on column number), so if you want to hide all blanks instead of just one column's blanks, you can repeat that line and adjust as necessary (or use a loop).
Sub FilterBlankAndDates()
With sheets("Sheet1").ListObjects("Table1").Range
.AutoFilter Field:=1, Criteria1:="<>"
.AutoFilter Field:=2, Criteria1:="<=" & Date
End With
End Sub
Upvotes: 1