PivotField.TotalLevels property (Excel)
Returns the total number of fields in the current field group. If the field isn't grouped, or if the data source is OLAP-based, TotalLevels returns the value 1. Read-only Long.
expression.TotalLevels
expression A variable that represents a PivotField object.
All fields in a set of grouped fields have the same TotalLevels value.
This example displays the total number of fields in the group that contains the active cell.
Worksheets("Sheet1").Activate
MsgBox "This group has " & _
ActiveCell.PivotField.TotalLevels & " levels
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.