ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   autofilter questions (https://www.excelbanter.com/excel-programming/400225-autofilter-questions.html)

Gary Keramidas

autofilter questions
 
1. is there a limit to the number of criteria?
2. how do you construct the statement when there is a variable number of
criteria?
for example, if an array has 3 elements, how do you filter on the 3
criteria.

for i = lbound(arr) to ubound(arr)
.AutoFilter Field:=1, Criteria1:=arr(i)
next

i can't figure out to how construct Criteria(i).
--


Gary




Dave Peterson

autofilter questions
 
You're limited by the same thing that you see when you do it manually.

In xl2003, there are two criteria.

I sometimes use a helper column with formulas that return true/false and then
filter by that column.



Gary Keramidas wrote:

1. is there a limit to the number of criteria?
2. how do you construct the statement when there is a variable number of
criteria?
for example, if an array has 3 elements, how do you filter on the 3
criteria.

for i = lbound(arr) to ubound(arr)
.AutoFilter Field:=1, Criteria1:=arr(i)
next

i can't figure out to how construct Criteria(i).
--

Gary


--

Dave Peterson

Dave Peterson

autofilter questions
 
ps. Record a macro when you do it manually and you'll see the code that works.

Gary Keramidas wrote:

1. is there a limit to the number of criteria?
2. how do you construct the statement when there is a variable number of
criteria?
for example, if an array has 3 elements, how do you filter on the 3
criteria.

for i = lbound(arr) to ubound(arr)
.AutoFilter Field:=1, Criteria1:=arr(i)
next

i can't figure out to how construct Criteria(i).
--

Gary


--

Dave Peterson

Gary Keramidas

autofilter questions
 
thanks dave, i think i'll just build a new report, probably take 10 minutes.

--


Gary


"Dave Peterson" wrote in message
...
You're limited by the same thing that you see when you do it manually.

In xl2003, there are two criteria.

I sometimes use a helper column with formulas that return true/false and then
filter by that column.



Gary Keramidas wrote:

1. is there a limit to the number of criteria?
2. how do you construct the statement when there is a variable number of
criteria?
for example, if an array has 3 elements, how do you filter on the 3
criteria.

for i = lbound(arr) to ubound(arr)
.AutoFilter Field:=1, Criteria1:=arr(i)
next

i can't figure out to how construct Criteria(i).
--

Gary


--

Dave Peterson





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

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