Add related procedures in class PivotItem (Excel VBA)

This page presents procedures from class PivotItem related to the theme Add: CalculatedItems.Add and PivotItems.Add

CalculatedItems.Add

Creates a new calculated item. Returns a PivotItem object.

Syntax : expression.Add (Name, Formula, UseStandardFormula)

Dim strName As String: strName = 
Dim strFormula As String: strFormula = 
Dim pvti As PivotItem
Set pvti = ActiveCell.PivotField.CalculatedItems.Add(Name:=strName, Formula:=strFormula)

Arguments

The following arguments are required:

Name (String) - The name of the item.

Formula (String) - The formula for the item.

The following argument is optional

UseStandardFormula (Boolean) - False (default) for upward compatibility. True for strings contained in any arguments that are item names; will be interpreted as having been formatted in standard U.S. English instead of local settings.

PivotItems.Add

Creates a new PivotTable item.

Syntax : expression.Add (Name)

Name: The name of the new PivotTable item.

Worksheets(1).PivotTables(1).PivotItems("Year").Add "1998"