VBA - AutoFilter Multiples in different formats?

sorexcuse

New Member
Joined
May 25, 2011
Messages
2
Been reading here alot to get me to understand VBA, now have a question I have not been able to find. I am, unfortunately working in 2003.

Have Data that I need to separate out and copy to a new sheet based on values in Column 3 and Column 1. The problem is, Column 1 contains the project number, and Column 3 contains the project name. Sorting these is no problem but sometimes there is the word "all" in column 1 or column 3. Here is an example, Say I am looking for everything associated with Project 3C in the following:

Number Project
1 A
2 B
3 C
All All
1 All
2 B

I need it to Filter to give me:

Number Project
3 C
All All

Tried this, but no luck:

Range("A9").AutoFilter Field:=1, _
Criteria1:=V, _
Operator:=xlAnd, Field:=3, Criteria2:="ALL", _
Operator:=xlOr, Field:=3, Criteria1:=Y

Where V = Project Number and Y = Project Name

Any suggestions would be greatly appreciated. Thank you.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Think I figured this out on my own, please let me know if you see any issues with this (went with a multi-layer approach) - Y is the varible used for Project Name, V = Project Number, and A = All

Range("A9").AutoFilter Field:=1, _
Criteria1:=V, Operator:=xlOr, _
Criteria2:=A
Range("A9").AutoFilter Field:=3, Criteria1:=Y, _
Operator:=xlOr, Criteria2:=A
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,828
Members
452,946
Latest member
JoseDavid

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