Friday, September 5, 2014

How to Set the Pivot Table Grand Totals on for Rows and Columns in Excel

Excel VBA Macro to Set the Pivot Table Grand Totals on Rows and Columns
Sub PVT_GrandTotals_OnRows_Columns ()
Dim Pivot_Name as String
'Select any in Cell the Pivot Table Area
ActiveSheet.Range("I4").Select 
'Storing Pivot Table Name in a Variable
Pivot_Name = Selection.PivotTable.Name

    With ActiveSheet.PivotTables(Pivot_Name)
        .ColumnGrand = True
        .RowGrand = True
    End With

End Sub

Eg :
Pivot Table without Grand Totals :
Pivot Table with Grand Totals on Rows and Columns:
Manually we can Set the Pivot Table Grand Totals on Rows and Columns by selecting "PivotTable Tools>Design>Grand Totals>On for Rows and Columns" as shown below.


By doing this we will get "Grand Total" for Columns at Last Row and for Rows at Last Column of the Pivot Table.

--------------------------------------------------------------------------------------------------------
Thanks, TAMATAM ; Business Intelligence & Analytics Professional
--------------------------------------------------------------------------------------------------------

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.

Featured Post from this Blog

How to compare Current Snapshot Data with Previous Snapshot in Power BI

How to Dynamically compare two Snapshots Data in Power BI Scenario: Suppose, we have a sample Sales data, which is stored with Monthly Snaps...

Popular Posts from this Blog