|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
How can I use a variable in an autofilter in VBA Hi friends, Can any one help me out,I want to use a variable where it is going to be used for autofilter. 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. I am using variable name instead of the value of the variable. Variables are dim as variants. |
#2
| |||
| |||
Re: How can I use a variable in an autofilter in VBA Sure i will help you out with this issue try to use the following code hope it would work for you. Criteria1:=">=" & StartDate |
#3
| |||
| |||
Re: How can I use a variable in an autofilter in VBA I try to follow the codes but it's not working for me and for more information i am using Excel 2002. |
#4
| |||
| |||
Re: How can I use a variable in an autofilter in VBA I was also facing similar kind of issue i try to use the following code and it worked for me. Range("A1: D200").AutoFilter 2, ">=02/01/2001", xlAnd, "<=02/01/2001" |
![]() |
|
Tags: autofilter, excel, variable, vba |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to enable Autofilter and Sorting in Protected Excel Sheet | ChittiBabu | Windows Software | 2 | 04-01-2012 08:38 PM |
Excel autofilter stops filtering | roumieh2000 | Windows Software | 3 | 15-10-2009 03:31 PM |
Runtime Error 91 : Object Variable or with block variable not set | Ryan21 | Software Development | 2 | 28-08-2009 07:51 PM |
Microsoft Excel autofilter has stopped working | McGrawh | Windows Software | 4 | 07-05-2009 02:31 PM |
What is Global Variable static? Declaring static variable instead of Global variable | Reckon | Software Development | 3 | 25-04-2009 11:34 AM |