Skip to content

Latest commit

 

History

History
53 lines (31 loc) · 1.29 KB

Excel.PivotTable.CalculatedMembers.md

File metadata and controls

53 lines (31 loc) · 1.29 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
PivotTable.CalculatedMembers property (Excel)
vbaxl10.chm235145
vbaxl10.chm235145
Excel.PivotTable.CalculatedMembers
65e7ffd6-e01d-f8fc-3adb-a1bcb1046fcf
05/08/2019
medium

PivotTable.CalculatedMembers property (Excel)

Returns a CalculatedMembers collection representing all the calculated members and calculated measures for an OLAP PivotTable.

Syntax

expression.CalculatedMembers

expression A variable that represents a PivotTable object.

Remarks

This property is used for Online Analytical Processing (OLAP) sources; a non-OLAP source will return a run-time error.

Example

This example adds a set to the PivotTable. It assumes that a PivotTable exists on the active worksheet that is connected to an OLAP data source that contains a field titled [Product].[All Products].

Sub UseCalculatedMember() 
 
 Dim pvtTable As PivotTable 
 
 Set pvtTable = ActiveSheet.PivotTables(1) 
 
 ' Add the calculated member. 
 pvtTable.CalculatedMembers.Add Name:="[Beef]", _ 
 Formula:="'{[Product].[All Products].Children}'", _ 
 Type:=xlCalculatedSet 
 
End Sub

[!includeSupport and feedback]