Skip to content

Latest commit

 

History

History
54 lines (33 loc) · 1.67 KB

Excel.CubeField.CreatePivotFields.md

File metadata and controls

54 lines (33 loc) · 1.67 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
CubeField.CreatePivotFields method (Excel)
vbaxl10.chm668099
vbaxl10.chm668099
Excel.CubeField.CreatePivotFields
87d868d7-8836-5a0b-a4b6-1ca3165b96e0
04/23/2019
medium

CubeField.CreatePivotFields method (Excel)

The CreatePivotFields method enables users to apply a filter to PivotFields not yet added to the PivotTable by creating the corresponding PivotField object.

Syntax

expression.CreatePivotFields

expression A variable that represents a CubeField object.

Remarks

In OLAP PivotTables, PivotFields don't exist until the corresponding CubeField is added to the PivotTable. The CreatePivotFields method enables users to create all PivotFields of a CubeField. Users can also add filters to the PivotFields and set properties on them before the CubeField is added to the PivotTable.

Example

Sub FilterFieldBeforeAddingItToPivotTable() 
 ActiveSheet.PivotTables("PivotTable1").CubeFields("[Date].[Fiscal]").CreatePivotFields 
 
 ActiveSheet.PivotTables("PivotTable1").PivotFields("[Date].[Fiscal].[Fiscal Year]").VisibleItemsList = 
 
 "[Date].[Fiscal].[Fiscal Semester]").VisibleItemsList = Array("") 
 ActiveSheet.PivotTables("PivotTable1").PivotFields( _ 
 "[Date].[Fiscal].[Fiscal Quarter]").VisibleItemsList = Array("") 
 
 ActiveSheet.PivotTables("PivotTable1").PivotFields("[Date].[Fiscal].[Month]"). _ 
 VisibleItemsList = Array("") 
 
 ActiveSheet.PivotTables("PivotTable1").PivotFields("[Date].[Fiscal].[Date]"). _ 
 VisibleItemsList = Array("") 
End Sub

[!includeSupport and feedback]