Filter on top 20

zabiullakhan

Active Member
Joined
Aug 30, 2010
Messages
310
i want to filter Top 20 visable records however the below code dosent work

Code:
GrabAdd = Selection.Address
 
Selection.AutoFilter GrabAdd, Criteria1:="20", Operator:=xlTop10Items

Please help.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
You haven't named the first argument and the Field argument should be numeric, not a string. Something like this should work:

Code:
GrabAdd = Selection.Column
 
Selection.AutoFilter Field:=GrabAdd, Criteria1:="20", Operator:=xlTop10Items
 
Upvote 0
Thanks a lot it works..

However i am not geting exact 20 when i filter on 2 to 3 col and take top 20. I guess i need to take top 20 visable fields.


Please help.
 
Upvote 0
If I filter 3 col before i take top 20 then i dont get top 20 rows, if i just take top 20 i get exact 20 row.

Can u please help me to filter on the 3 columns and then take exact top 20..
Please help
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,181
Members
452,893
Latest member
denay

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