Last try
Sub total()
[a1].CurrentRegion.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(6, 7, 8)
ActiveSheet.Outline.ShowLevels RowLevels:=2
With [a1].CurrentRegion
With .Offset(1).Resize(.Rows.Count - 1).SpecialCells(12)
.Columns(2).Select
.Borders.ColorIndex = 1
.Interior.Color = 3243501
.Font.Bold = True
End With
.Offset(1, 1).Resize(.Rows.Count - 1, 1).SpecialCells(12).Value = "TOTAL"
.ClearOutline
With .Offset(1).Resize(.Rows.Count - 1, 1)
.FormulaR1C1 = "=if(rc2=""TOTAL"","""",n(r[-1]C)+1)"
.Value = .Value
End With
End With
End Sub
Bookmarks