How to make a macro auto-filter that the user can choose date?

Hi, I need a macro to use auto-filter to do 2 things. The first is in column A select blank cells and then in column N select a date range.
The user needs to input TODAY's date and that's all.
Could the auto-filer select all dates after today's date?

Jimi ShermanAsked:
Who is Participating?
byundtConnect With a Mentor Commented:
Here is a macro that lets the user choose a date. The inputbox defaults to the current date. The macro then filters column A for blanks and column N for values after the user-specified date.
Sub Postdated()
Dim rg As Range
Dim sDate As String
Dim dat As Date
sDate = InputBox("Only show column N dates after this date", Default:=Format(Date, "m/d/yyyy"))
If Not IsDate(sDate) Then Exit Sub

dat = CDate(sDate)
sDate = ">" & Format(dat, "m/d/yyyy")
Set rg = ActiveSheet.UsedRange
rg.AutoFilter Field:=1, Criteria1:="="
rg.AutoFilter Field:=14, Criteria1:=sDate, Operator:=xlAnd
End Sub

Open in new window

Jimi ShermanAuthor Commented:
Thank you so much Brad
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.