title | keywords | f1_keywords | api_name | ms.assetid | ms.date | ms.localizationpriority | ||
---|---|---|---|---|---|---|---|---|
CubeFields object (Excel) |
vbaxl10.chm669072 |
|
|
cfb7b4f4-e9c3-45a3-daa4-fe4d3c52fb1f |
03/29/2019 |
medium |
A collection of all CubeField objects in a PivotTable report that is based on an OLAP cube. Each CubeField object represents a hierarchy or measure field from the cube.
Use the CubeFields property of the PivotTable object to return the CubeFields collection. The following example creates a list of cube field names of the data fields in the first OLAP-based PivotTable report on Sheet1.
Set objNewSheet = Worksheets.Add
intRow = 1
For Each objCubeFld In _
Worksheets("Sheet1").PivotTables(1).CubeFields
If objCubeFld.Orientation = xlDataField Then
objNewSheet.Cells(intRow, 1).Value = objCubeFld.Name
intRow = intRow + 1
End If
Next objCubeFld
Use CubeFields (index), where index is the cube field's index number, to return a single CubeField object. The following example determines the name of the second cube field in the first PivotTable report on the active worksheet.
strAlphaName = _
ActiveSheet.PivotTables(1).CubeFields(2).Name
[!includeSupport and feedback]