Excel VBA filter

meadt

Registered User.
Local time
Today, 23:03
Joined
Oct 29, 2009
Messages
45
Hi Guys,

I've been playing around with this all day and can't seem to get it to work.
http://www.access-programmers.co.uk/forums/forumdisplay.php?f=69
I am filtering a column of numbers for anything greater than the value of a variable. The code works when I write in the number itself, but can't write a version that uses the variable (strDate) I'm guessing the problem is the syntax but I haven't been doing VBA long enough to work out how to write it!

Selection.AutoFilter Field:=22, Criteria1:=">=20100301", Operator:=xlAnd

Thanks in advance for any help!

T.
 
Selection.AutoFilter Field:=22, Criteria1:=">=20100301", Operator:=xlAnd
Try this (although you should use a date variable and not a string variable for the date since it is a date):

Selection.AutoFilter Field:=1, Criteria1:=">=#" & strDate & "#", Operator:=xlAnd
 

Users who are viewing this thread

Back
Top Bottom