Auto filter criteria

Craig1

Active Member
Joined
Jun 11, 2009
Messages
320
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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Try

Code:
Selection.AutoFilter Field:=13, Criteria1:="In progress", Criteria2:="Not started", Operator:=xlAnd
 

Craig1

Active Member
Joined
Jun 11, 2009
Messages
320
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.
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Perhaps

Rich (BB code):
Selection.AutoFilter Field:=13, Criteria1:="In progress", Criteria2:="Not started", Operator:=xlOr
 

Craig1

Active Member
Joined
Jun 11, 2009
Messages
320
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.
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
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:
 

Forum statistics

Threads
1,141,017
Messages
5,703,752
Members
421,313
Latest member
Mooncake1

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
Top