Name

pivottable.ColumnGrand [= setting]

Synopsis

True displays grand totals for column fields; False omits grand totals. Default is true. The following code turns column grand totals on and off:

Sub ToggleColumnTotals(  )
    ' Ignore error if sheet doesn't have a pivot table.
    On Error Resume Next
    ' Turn totals on/off.
    ActiveSheet.PivotTables(1).ColumnGrand = _
      Not ActiveSheet.PivotTables(1).ColumnGrand
    On Error GoTo 0
End Sub

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.