Problem using Autofilter

A

alishehzad

Hi Everyone,

I have come across a strange problem while using the Autofilter in
Excel Macros.

I have to Filter my data based on two columns. In One column i need to
place the filter with Entries equallying #N/A. And in the second one
Entries NOT Equal to Zero.

THE PROBLEM is that whenever i apply the filter .... the LAST Entry of
the list Does NOT get filtered.

I have tried to use different approaches like
-------------------- Code -------------------------------
Range("B1").Select
Selection.AutoFilter Field:=ActiveCell.Column, Criteria1:="#N/A"
Range("J1").Select
Selection.AutoFilter Field:=ActiveCell.Column, Criteria1:="<>0",
Operator:=xlAnd
-------------------------------------------------------------

or

----------------------- Code -----------------------------
Rows(1).AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="#N/A"
Selection.AutoFilter Field:=10, Criteria1:="<>0", Operator:=xlAnd
-------------------------------------------------------------
and even
----------------------- Code -----------------------------
Cells.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:="#N/A"
Selection.AutoFilter Field:=10, Criteria1:="<>0", Operator:=xlAnd
-------------------------------------------------------------

But in all cases the last Row doesnt get filtered. Ive tried to change
the number of rows by deleting some entries ( I thought perhaps filter
has a limit) But what ever the number of rows, the last row doesnt get
filtered.

Am I making some stupid mistake ? or is there some problem with my
Excel ???

Kindly HELP !
 
D

Debra Dalgleish

If the last line of data contains a SUBTOTAL formula, it may not be
included in the filtered range.
You could remove the subtotal, or add another row at the end of the
range, then the filter should include that last row.
 

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

Similar Threads

Problem Using Auto Filter 3
Apply macro to all worksheets 15
How to Activate Filter in Protected Sheet 2
Help me4 2
Automated autofilter error 1
AutoFilter Criteria in VBA 13
Error Handle problem 4
Custom filter 26

Top