Filtering column for dates

DJhuffman

New Member
Joined
Apr 16, 2019
Messages
25
So part of the process I wish to incorporate into my macro includes a step where I would filter column D (which are a series of dates) by two requirement:
1) Show all dates before last month
and
2) Show all dates listed as 00/00/00

I was able to filter for the dates before last month using:

Code:
    Dim sdt As Date
    sdt = Month(Date) - 1 & "/1/2019"
    ActiveSheet.UsedRange.AutoFilter 4, "<" & sdt

But I have yet to determine how I might be able to broaden the command to include all dates listed as 00/00/00. Any thoughts?
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Maybe

Code:
Dim sdt As Date

sdt = Month(Date) - 1 & "/1/2019"
ActiveSheet.UsedRange.AutoFilter 4, Criteria1:="<" & sdt, Operator:=xlOr, Criteria2:="00/00/00"

M.
 
Upvote 0
I think that did it. Thank you! I had attempted something similar in other attempts, but I see that my mistake was using the wrong operator.
 
Upvote 0

Forum statistics

Threads
1,215,006
Messages
6,122,665
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top