M
marcia2026
I have a macro that is in part from a recorded macro and part from on of
these posts. It doesn't quite do what it needs to. For some reason, some of
my subtotals need to be formulated as: =round(subtotal(9,A1:A2),2) in order
to get the formating correct. I use the accounting method so that zero
totals will be a dash instead of a 0. Can someone please tell me how to
alter my subtotal formula?
thanks
marcia
these posts. It doesn't quite do what it needs to. For some reason, some of
my subtotals need to be formulated as: =round(subtotal(9,A1:A2),2) in order
to get the formating correct. I use the accounting method so that zero
totals will be a dash instead of a 0. Can someone please tell me how to
alter my subtotal formula?
Code:
Sub Subtotals()
'Create subtotals
Range("A2").Select
Selection.Subtotal GroupBy:=3, Function:=xlSum, TotalList:=Array(6, 7),
Replace:=True, PageBreaks:=False, SummaryBelowData:=True
'Round off the subtotals so that zeros will be in accounting format
Dim myC As Range
For Each myC In Cells.SpecialCells(xlCellTypeFormulas, 23)
If InStr(1, myC.Formula, "SUBTOTAL") > 0 Then
myC.Font.Bold = True
myC.NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(* ""-""??_);_(@_)"
End If
Next myC
End Sub
thanks
marcia