XLA routines: EE_PivotRemoveSubtotals

Nick's picture
EE_PivotRemoveSubtotals allows you to remove the subtotals from your pivot. - in my view, Subtotals should be off by default, as I almost never use them
Sub EE_PivotRemoveSubtotals(pt As PivotTable)
    Dim ptField     As PivotField
 
'http://excelexperts.com/xla-routines-eePivotRemoveSubtotals    for updates on this sub routine

    On Error Resume Next
        For Each ptField In pt.PivotFields
            'Set index 1 (Automatic) to True first
            'so that all other values are set to False
            ptField.Subtotals(1) = True
            ptField.Subtotals(1) = False
        Next ptField
    Err.Clear: On Error GoTo 0: On Error GoTo -1
 
    Set ptField = Nothing
End Sub