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

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
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,214,822
Messages
6,121,772
Members
449,049
Latest member
greyangel23

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