Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Passing a named varaible to Excel's Autofilter

Does anyone know how to use a variable name in these sorts
of statements?

Selection.AutoFilter field:=14, Criteria1:="<*R*",
Operator:=xlOr, _
' Criteria2:="<*H*"

and

Selection.AutoFilter field:=14, Criteria1:="=(Blank)",
Operator:=xlAnd

Work for finding records that contain blanks or do not
contain "R" or "H". However, given a variable for a date
named "FWDATE", the statement;

Selection.AutoFilter field:=10,Criteria1:"FWDATE",
Operator:=xlAnd

does not work.

Any help would be appreciated.




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Passing a named varaible to Excel's Autofilter


Dim FWDATE as DATE
FWDATE = DateValue("10/25/2003")
Selection.AutoFilter field:=10,Criteria1:="" & clng(FWDATE"), _
Operator:=xlAnd

Not sure what you mean by a date named FWDATE. I will assume FWDATE is a
variable of type DATE that has been assigned a value.

--
Regards,
Tom Ogilvy


"Jeff Glock" wrote in message
...
Does anyone know how to use a variable name in these sorts
of statements?

Selection.AutoFilter field:=14, Criteria1:="<*R*",
Operator:=xlOr, _
' Criteria2:="<*H*"

and

Selection.AutoFilter field:=14, Criteria1:="=(Blank)",
Operator:=xlAnd

Work for finding records that contain blanks or do not
contain "R" or "H". However, given a variable for a date
named "FWDATE", the statement;

Selection.AutoFilter field:=10,Criteria1:"FWDATE",
Operator:=xlAnd

does not work.

Any help would be 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
excel 2007 autofilter change to 2003 autofilter functionality? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 10:05 PM
2007 excel autofilter back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 3 April 19th 10 08:11 PM
2007 excel autofilter change back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 05:53 PM
Hyperlink varaible substitution - How To Sledge Bacon Excel Worksheet Functions 10 May 29th 08 06:03 PM
Passing Excel NAMED Range to VBA BG Excel Worksheet Functions 4 July 28th 05 05:23 PM


All times are GMT +1. The time now is 10:59 AM.

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"