Autofilter / Advanced Filter Copying over all data

jaspalsd

Board Regular
Joined
Feb 3, 2014
Messages
72
Hi,

This is a bit frustrating. I've applied code to filter data using the autoFilter function but when I apply a new line with AdvancedFilter it appears it clears the filtered range and copies over all data

Code:
With Sheets(1).ListObjects("Table13256").Range.AutoFilter Field:=22, Criteria1:="<>"
.Columns("E").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Sheets("XYZ").Range("A2"), Unique:=True
End With

Basically, in column/field 22 I've applied formula to apply "90" else blanks "<>" . This works but when I apply the AdvancedFilter Action then it undoes the filter.

Can someone please advise.

Please note in the copied destination worksheet I then apply a sumifs formula by the unique values in Column E, so I could then apply code to filter and delete rows when the sumifs formula returns zero values as a workaround.

Thanks!
 
Last edited:

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
sorry,

I've amended it and it's bringing back everything that relates to "90" which I want except now it brings back two more results than I expected - these two results definitely don't have "90" in column V.

Code:
With Sheets(1).ListObjects("Table13256").Range.AutoFilter Field:=22, Criteria1:="=90"
End With




Sheets(1).Select


Range(Range("E1"), Range("E1").End(xlDown)).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Sheets("XYZ").Range("A2"), Unique:=True
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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