Auto filter criteria

Craig1

Active Member
Joined
Jun 11, 2009
Messages
322
Hi Guys,
I have been scratching my head over this for a couple of hours, can it be done.
I have the code below

Selection.AutoFilter Field:=13, Criteria1:="In progress", Operator:=xlAnd

What I also need the code to do is as well as "In progress" in the same column I want it to filter "Not started".

I tried:-
Selection.AutoFilter Field:=13, Criteria1:="In progress" & "Not started", Operator:=xlAnd
and a few other variations but all to no avail, can it be done????

Any help would be appreciated.

Craig.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Try

Code:
Selection.AutoFilter Field:=13, Criteria1:="In progress", Criteria2:="Not started", Operator:=xlAnd
 
Upvote 0
Thanks for the quick reply Peter.

That was one of the variations and it didn't work, but thinking I had a comma missing or something like that I tried again and still no joy. It just shows a blank.

Craig.
 
Upvote 0
Perhaps

Rich (BB code):
Selection.AutoFilter Field:=13, Criteria1:="In progress", Criteria2:="Not started", Operator:=xlOr
 
Upvote 0
Thanks Peter, that worked perfectly.
What is the difference between
Operator:=xlAnd
and
Operator:=xlOr

Is it simply as it looks "and" or "or"

Craig.
 
Upvote 0
Yes, exactly. That's why you got no records originally since you wouldn't have both phrases in a cell at the same time. I should have spotted that :oops:
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top