Loss of Autofilter

M

mpb

Good Evening All,

I have below short code for a macro to sort a list using
advanced filter copy unique values to another worksheet.
I also like to have the Autofilter enabled on both
worksheets. However, when the macro is run, the Autofilter
on the source worksheet ("Invoice Record"), is lost and
has to be re-enabled manually.

This is annoying glich, and a fix would be most welcome.
Cheers, Cordially
MPB

Sub ECRGeneralReportPopulation()
' General Report Data Population From Invoice Record
Application.Interactive = False
Dim myRng As Range
Sheets("General Report").Range("A:A").ClearContents
With Sheets("Invoice Record")
Set myRng = .Range("A2", .Cells(.Rows.Count, "A").End
(xlUp))
End With
myRng.AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Sheets("General Report").Range("A2"),
Unique:=True
Application.Interactive = True
End Sub
 

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

Top