View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
saf saf is offline
external usenet poster
 
Posts: 1
Default fORMULA IN aUTO FILTER

How do I enter this criteria into an advanced filter? I can put in the first
criteria :="=" & Now(), but the second one eludes me.

Thanks

"Bernie Deitrick" wrote:

sf,

Try

Range("C:C").AutoFilter Field:=1, _
Criteria1:="=" & Now(), _
Operator:=xlAnd, _
Criteria2:="<=" & Now() + 30


--
HTH,
Bernie
MS Excel MVP
"sf" wrote in message
...
Thanks, but how do I reference a range of dates such that the range is

equal
to today and today +30 days

I can't seem to locate info on how to enter a range in Advanced filter

"Bernie Deitrick" wrote:

dw,

In VBA code, you can do something like this, to filter column C. The
numberformat is necessary because Excel filters based on formatted

values.

Range("C:C").AutoFilter Field:=1, Criteria1:=Format(Now(),
Range("C2").NumberFormat)

HTH,
Bernie
MS Excel MVP

"dw" wrote in message
...
Can I insert a formula into the autofilter? for example I want to find

all
items due today. So I might use the Now() function to return todays

date
in
the vba code.