ShowAs Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.  

PivotShowAsEnum

PivotShowAsEnum can be one of these PivotShowAsEnum constants.
plShowAsNormalDefault 
plShowAsPercentOfColumnParent Display the totals as a percentage of the total of each item's parent column.
plShowAsPercentOfColumnTotal Display the totals as a percentage of the total of each item's column.
plShowAsPercentOfGrandTotal Display the totals as a percentage of the grand total of all the data.
plShowAsPercentOfRowParent Display the totals as a percentage of the total of each item's parent row.
plShowAsPercentOfRowTotal Display the totals as a percentage of the total of each item's row.

expression.ShowAs

expression   Required. An expression that returns a PivotTotal object.

Example

This example adds a new total to PivotTable1. The new total is formatted to display as a percentage of the parent row field, and will not appear in the PivotTable Field List dialog box.

  Sub Add_Total()

    Dim vwView
    Dim ptConstants
    Dim totNewTotal

    Set vwView = PivotTable1.ActiveView
    Set ptConstants = PivotTable1.Constants

    ' Add a new total named "Total Budget" to the current view.
    Set totNewTotal = vwView.AddTotal("Total Budget", vwView.FieldSets("Budget").Fields(0), _
             ptConstants.plFunctionSum)

    ' Insert the newly created total into the detail area of the PivotTable.
    vwView.DataAxis.InsertTotal totNewTotal

    ' Show the totals as a percentage of the parent row field.
    totNewTotal.ShowAs = ptConstants.plShowAsPercentOfRowParent

    ' Do not display the new total in the PivotTable Field List dialog box.
    totNewTotal.DisplayInFieldList = False

End Sub