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.
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
.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
--------------------------------------------------------------------------------------------------------
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.