Excel Filters don't allow you to use more than two criteria.
If you're wanting to do something beyond two, you'll have to use some other 
method.
You could create a "flag" column.
In the macro, reset the "flags" and then process the records, comparing it to 
your criteria.
Set the "flag" for each record that matches (or doesn't match).
Then use the filter to hide the appropriate flag values.

as for blanks, you can record a macro in which you hide blank values and check 
the result.
 
Paul
-----------------------------------------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-----------------------------------------




________________________________
From: colmkav <colmj...@gmail.com>
To: excel-macros@googlegroups.com
Sent: Fri, April 12, 2013 11:49:40 AM
Subject: $$Excel-Macros$$ Re: using autofilter in VBA to exclude items


Thanks Paul, this works for 2 criteria. What should I do for a third criteria?

the following does not seem to work:

ActiveSheet.Range("$A$13:$T$763").AutoFilter Field:=1, Criteria1:="<>BALANS - 
PASSIVA", _
                Operator:=xlAnd, Criteria2:="<>WINST- EN VERLIESREKENING 
(V&W)", 
Operator:=xlAnd, Criteria3:="<>"

By the way how do I filter out blanks?

thanks
Colm

On Friday, April 12, 2013 9:46:40 AM UTC+2, colmkav wrote:
Hi,
>
>how do I exclude items using VBA code? I thought I would get the code using 
>record macro but it only gave code to include items.
>
>eg
>    Range("A13").Select
>    ActiveSheet.Range("$A$13:$T$ 763").AutoFilter Field:=1, Criteria1:=Array( _
>        "10125014", "11394750", "2234200120", "2234600120", "52039100", 
>"52080100", _
>        "54004912", "54004916"), Operator:=xlFilterValues
>
>I would like to exclude 3 items
>
>Colm-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel
 
FORUM RULES
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.
 
NOTE : Don't ever post confidential data in a workbook. Forum owners and 
members 
are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to