how can i filter top 20 items?

Status
Not open for further replies.

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Code:
    ActiveSheet.Range("YOUR RANGE").AutoFilter Field:=1, Criteria1:="20", _
        Operator:=xlTop10Items
 
Upvote 0
how can i filter top 20 items from VB code.

Please help
Turn the macro recorder on and do it manually and then you should at least have some starter code.

If you need further help after that, post the code you have so far tell us more about your sheet's layout and data and what went wrong with using the code from the recorder.
 
Upvote 0
i get this error on the second line
"AutoFilter method of range class failed"
Code:
GrabAdd = Selection.Address

Selection.AutoFilter GrabAdd, Criteria1:="20", Operator:=xlTop10Items
Please help
 
Upvote 0
You haven't used the syntax suggested and we also don't know what the 'Selection' is, but you need something more like this.
Rich (BB code):
Selection.AutoFilter Field:=3, Criteria1:="20", Operator:=xlTop10Items
Where you need to change the 3 to whatever column of the selection you want the filter to check for the top 20 values.
 
Upvote 0
how to select the visible rows only after filtering and determine the no of rows selected?

i just want to select 10 rows which are visible but after filtering it selects the invisable rows too..

Please help
 
Upvote 0
This works? thanks a lot

i am stuck with this issue.
how to select the visible rows only after filtering and determine the no of rows selected?

i just want to select 10 rows which are visible but after filtering it selects the invisable rows too..

Please help
 
Upvote 0
Questions of a duplicate nature will be locked or deleted, per the Posting Rules (especially points 21-23).

Since you have asked this question elsewhere and the original question here appears to be resolved, I'm closing this thread.

Any bumps, clarifications, or follow-ups should be posted back to the linked thread.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,224,566
Messages
6,179,558
Members
452,928
Latest member
101blockchains

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