Hi Dave........
I just don't seem to be able to get it together. It all seems to work, but
for some reason skips the top two groups.........then goes on to perform as
expected, increasing the height of the subtotal rows as desired and placing
the values at the top of those cells.
Here's the code with the mods for my application.......if you see anything
that might be causing what I've described, please holler....
Sub testme()
Dim myRng As Range
Dim myVRng As Range
Dim LastRow As Long
Dim LastCol As Long
With Worksheets("MonthlyReport") 'chd to my worksheet, was Sheet1
LastRow = .Cells(.Rows.Count, "h").End(xlUp).Row 'chd to column
where grand total is (was A)
LastCol = .Cells(7, .Columns.Count).End(xlToLeft).Column 'chd to row
7 as ref instead of row 1
Set myRng = .Range("a7", .Cells(LastRow, LastCol)) 'chd to just
above freeze line, was A1
'=====================================================
'deleted Dave's 3 rows and added my subtotal stuff
' myRng.Subtotal GroupBy:=1, Function:=xlCount, _
' TotalList:=Array(7, 8, 9), Replace:=True, PageBreaks:=False, _
' SummaryBelowData:=True
myRng.ClearOutline
myRng.sort Key1:=Range("h8"), Order1:=xlAscending, Key2:=Range("B8") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
myRng.Subtotal GroupBy:=8, Function:=xlSum, TotalList:=Array(15, 16, 17,
18, 19, 22, 23, 24), _
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
'=====================================================
.Outline.ShowLevels RowLevels:=2
With myRng
Set myVRng = .Resize(.Rows.Count - 1).Offset(7, 0) _
.Cells.SpecialCells(xlCellTypeVisible)
End With
With myVRng
.EntireRow.RowHeight = 50
.VerticalAlignment = xlTop
End With
.Outline.ShowLevels RowLevels:=3
End With
End Sub
thanks,
Vaya con Dios,
Chuck, CABGx3
CLR said:
Thanks Dave..........I'll give it a shot tomorrow where I have the file at
work. I already have the Subtotal part, so from what I see it should be
doable for me to be able to cut it in.......I'll let you know how it
goes..............thanks for the help!
Vaya con Dios,
Chuck, CABGx3