ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Custom filtering in excel 2003 with more than 2 multifilter option (https://www.excelbanter.com/excel-programming/390044-custom-filtering-excel-2003-more-than-2-multifilter-option.html)

Gibu John George

Custom filtering in excel 2003 with more than 2 multifilter option
 
I am working on a macro to filter out a column in Excel 2003. but i am
facing a problem in the Custom option of Auto filter, it can check for only 2
values using And / Or

Selection.AutoFilter Field:=5, Criteria1:="=a",
Operator:=xlOr,Criteria2:="=b"

Is there any way to increase this to more than 2 values?

I have also tried
Selection.AutoFilter Field:=5, Criteria1:="=a", Operator:=xlOr,
Criteria2:="=b", Operator :=xlOr,Criteria3:="=c"

but still no joy.

I have also tried putting the Criteria as an array, as used in excel 2007,
but those dont work in excel 2003

ActiveSheet.Range("$A$1:$AP$437").AutoFilter Field:=2, Criteria1:=Array(
"a", "b", "c") , Operator:=xlFilterValues

Is there any solution for this?

Bob Phillips

Custom filtering in excel 2003 with more than 2 multifilter option
 
Not that I know of.

I tend t0 create a helper column with a formula that checks all possible
options and outputs TRUE or FALSE, and filter by the helper column.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Gibu John George" <Gibu John wrote in
message ...
I am working on a macro to filter out a column in Excel 2003. but i am
facing a problem in the Custom option of Auto filter, it can check for
only 2
values using And / Or

Selection.AutoFilter Field:=5, Criteria1:="=a",
Operator:=xlOr,Criteria2:="=b"

Is there any way to increase this to more than 2 values?

I have also tried
Selection.AutoFilter Field:=5, Criteria1:="=a", Operator:=xlOr,
Criteria2:="=b", Operator :=xlOr,Criteria3:="=c"

but still no joy.

I have also tried putting the Criteria as an array, as used in excel 2007,
but those dont work in excel 2003

ActiveSheet.Range("$A$1:$AP$437").AutoFilter Field:=2, Criteria1:=Array(
"a", "b", "c") , Operator:=xlFilterValues

Is there any solution for this?




Shailesh Shah[_2_]

Custom filtering in excel 2003 with more than 2 multifilter option
 

You can use Advancefilter method using criteria Range in a worksheet.
See more details in VBA Help.

Regards,
Shah Shailesh
http://in.geocities.com/shahshaileshs/
(Excel Add-ins Page)

*** Sent via Developersdex http://www.developersdex.com ***


All times are GMT +1. The time now is 11:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com