Thread
:
Excel! How can I use a variable in an autofilter in VBA?
View Single Post
#
2
Posted to microsoft.public.excel.programming
Nigel[_2_]
external usenet poster
Posts: 735
Excel! How can I use a variable in an autofilter in VBA?
Try
Criteria1:="=" & StartDate
--
Regards,
Nigel
"alskdjfhgzmxncbv" wrote in
message ...
I want to use a variable as the criteria for an autofilter.
What I have is this:
ActiveSheet.Range("$A$1:$S$277").AutoFilter Field:=1,
Criteria1:="=StartDate", Operator:=xlAnd, Criteria2:="<=EndDate"
where StartDate and EndDate would be assigned date values to filter
between
those dates. Results are no records as the variable name is used instead
of
the value of the variable.
Variables are dim'ed as variants.
Thanks.
Reply With Quote
Nigel[_2_]
View Public Profile
Find all posts by Nigel[_2_]