Advanced Filtering problem

G

george-smith

When I try this code, all of rows 2 through rows 8 on the worksheet
"Test" are filtered and no longer visible.
I would have expected rows 3 through 4 and 6 through 7 to be filtered.
Can someone tell me what I am doping incorrectly?

tia
bob

Sheets("Test").Range("D1:D8").AdvancedFilter _
Action:=xlFilterInPlace, _
CriteriaRange:=Sheets("zzzzWorkSpaceSheet").Range("A1:A5"), _
Unique:=False

Sheet:Test contains this data in Column D starting at row 1
HEADER
r
d
f
r
g
h
r

Sheet:zzzzWorkSpaceSheet contains this data in Column A starting at
row 1
Crit
d
f
g
h
 
D

Doug Glancy

George,

Your zzzzWorkSheet should have this format:

In cells A1 to D1, enter the word "HEADER" (assuming that is really the
header name in the other sheet).
In A2 enter "d"
In B3 enter "f"
In C4 enter "g"
and in D5 enter "h"

To filter "d" OR "f" OR "g" OR "h" as you are doing here each criteria has
to be on a different row. Putting them in the same row is a logical AND.
Having them all in the same column as you did... well, I'm not sure what it
means, but it doesn't work.

hth,

Doug
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top