LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Custom AutoFilter to Compare Due Dates to Current Date

Column D of my spreadsheet contains due dates. I need a macro that will
activate the Custom AutoFilter and compare the due dates to the current date.
The macro should then display only those entries where the due date is less
than or equal to the current date.

I tried using
=TODAY()
in the Custom AutoFilter dialog box. However, the system does not retrieve
any "hits."

In searching this forum, I came across the following code:

& CLng(Date)

and used it in my macro as follows:

Sub ApplyDateStatusFilter()
' Filters by Due Date (displays any entry that matches current date or any
date prior to current date)
Selection.AutoFilter Field:=4, Criteria1:="<=" & CLng(Date), Operator:=xlAnd
End Sub

The macro works -- but I don't understand what the

& CLng(Date)

does in the macro. Can someone help? Is there a better/different way to
achieve the desired result?

Thank you!!

Cristina
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom format date cells-Autofilter doesn't work right honyacker Excel Discussion (Misc queries) 0 June 26th 07 05:59 PM
How do I get the most current date from a list of dates? GenaM Excel Discussion (Misc queries) 3 July 18th 06 03:25 PM
Compare current date to 2 dates Terri Excel Programming 1 October 21st 04 03:55 PM
Compare Current Date InnerChild[_2_] Excel Programming 1 July 13th 04 03:10 PM
Custom Date in Autofilter Michael Singmin Excel Programming 3 June 15th 04 11:14 PM


All times are GMT +1. The time now is 12:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"