Zach
Member
Ladies/Gentlemen
I need to get a sort statement in here. It pulls all the data and does all the subtotaling I want but I need it to sort first. I forgot that part and need column "G" to sort before it subtotals.
Any suggestions?
I'm attaching the file as well.
Thanks
I need to get a sort statement in here. It pulls all the data and does all the subtotaling I want but I need it to sort first. I forgot that part and need column "G" to sort before it subtotals.
Any suggestions?
Code:
'Filter file
CVT.Select
CVT.Range(Cells(1, 1), "K" & lLast).AutoFilter Field:=2, Criteria1:="Phoenix"
CVT.Range(Cells(1, 1), "K" & lLast).SpecialCells(xlCellTypeVisible).Copy
MTab.Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
With MTab
.Select
.Cells.Select
.Cells.EntireColumn.AutoFit
lLast = .Range("A" & Rows.Count).End(xlUp).Row
.Sort.SortFields.Add Key:=Range(.Cells(1, 1), "G" & lLast) _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
.Range(.Cells(1, 1), "K" & lLast).Subtotal GroupBy:=7, Function:=xlSum, TotalList:=Array(11), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
lLast = .Range("G" & Rows.Count).End(xlUp).Row
With .Range(.Cells(1, 1), "K" & lLast).Borders
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
I'm attaching the file as well.
Thanks