Autofilters

eqbal

Board Regular
Joined
Sep 6, 2002
Messages
92
Hi,

This is the method in which we use the autofilter according to Excel’s VBA help: expression.AutoFilter(Field, Criteria1, Operator, Criteria2, VisibleDropDown).
I have a sheet in which I want to filter my accounts that are in range “G:G” according to the criteria that are put in range “P:P” as is shown below:

Criteria:

Banks
Customers
Sells
.....

How should I use the above code? What is “expression”? What is “Field” ( is it a range)?
 

Some videos you may like

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Juan Pablo González

MrExcel MVP
Joined
Feb 8, 2002
Messages
11,959
Are you trying to autofilter with more than 2 conditions ? that's not possible. You'll have to use Advanced filter (Which may suit a lot more in your case !), and you can even record a macro while you do that to get the proper structure.
 

eqbal

Board Regular
Joined
Sep 6, 2002
Messages
92
Hi,

Tnx for ur reply to my post: autofilter. No I'm not going to use autofilter with 2 or more conditions. I have written a code that autofilters some range criteria by criteria (the criteria := sheets(1).cells(12,i) ). It worked at first but after running and debugging 2 or 3 times the code (the autofilter code was untouchd)encounters a 1004 runtime error, which is quite ilogical.

I think that it is because I don't know the method in which the autofilter should be used.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,561
Messages
5,596,853
Members
414,107
Latest member
Tigretto

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