Thursday, August 7, 2014

Advancedfilter Using VBA













Sub testAdvancefilter()
'remove current filter
ThisWorkbook.Sheets("Summary").Range("B10").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Clear
'*********************************
ThisWorkbook.Sheets("Data").Range(ThisWorkbook.Sheets("data").Range("A1").CurrentRegion.Address).AdvancedFilter Action:=xlFilterCopy, criteriarange:=ThisWorkbook.Sheets("Data").Range("M1:P2"), copytorange:=ThisWorkbook.Sheets("Summary").Range("B10"), unique:=True
Columns.AutoFit
End Sub
















Download File

Sample file

No comments:

Post a Comment