wilster2012
New Member
- Joined
- Jul 8, 2016
- Messages
- 7
Hello Group, I'm having a problem I hope somebody has a solution to
I am working on a macro that copies data from a pivot table to a new sheet then sorts the data from largest to smallest then filters the data. Everything works fine until I filter the data. After it filters, I lose the sort. Below is the code for the sort and filter subs. Any help would be appreciated
Thanks in Advance
Willy
I am working on a macro that copies data from a pivot table to a new sheet then sorts the data from largest to smallest then filters the data. Everything works fine until I filter the data. After it filters, I lose the sort. Below is the code for the sort and filter subs. Any help would be appreciated
Code:
Sub newsort()
With ActiveWorkbook.Worksheets("NewSort").Sort
.SetRange Range("A1:D217")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Call AutoFilterCopy
End Sub
Sub AutoFilterCopy()
With Sheet13
.AutoFilterMode = False
.Range("E1").AutoFilter
.Range("a1").AutoFilter Field:=5, Criteria1:="copy"
.Range("a1").AutoFilter Field:=6, Criteria1:="FALSE"
End With
End Sub
Thanks in Advance
Willy