Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Setting autofilter at runtime

Hello,

I am trying to set an autofilter to a custom filter when a user clicks
command button. The code I have linked to the button follows. The goal is
to get the autofilter to return rows where the date in the field is less
than or equal to today. I think I can see that the problem is that the code
is seeing the string "=Now" as a literal string without evaluting the
expression within it.

Dim lDate As Date
Selection.AutoFilter Field:=12, Criteria1:="<= Now", Operator:=xlAnd
End Sub

Any help would be greatly appreciated.


Reply
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
autofilter macro setting tjb Excel Worksheet Functions 0 June 11th 08 05:36 PM
Macro runtime error 1004 with Autofilter Lorna B Excel Discussion (Misc queries) 3 May 25th 07 08:38 PM
Setting autofilter criteria peterDavey Excel Programming 1 June 11th 04 09:47 AM
Propblem setting OnAction property at runtime Philip Excel Programming 2 January 26th 04 05:51 PM
Setting AutoFilter to 1 row of data Greg Bloom Excel Programming 1 September 26th 03 11:09 PM


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

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

About Us

"It's about Microsoft Excel"