Class PivotLine (Excel VBA)

A PivotLine object is a line of rows or columns in an Excel PivotTable.


To use a PivotLine class variable it first needs to be instantiated, for example

Dim lngIndex As Long: lngIndex = 
Dim pas As PivotAxis: Set pas = 
Dim pvtlnPivotLine As PivotLine
Set pvtlnPivotLine = pas.PivotLines(Index:=lngIndex)

The following procedures can be used to set variables of type PivotLine: PivotCell.PivotColumnLine, PivotCell.PivotRowLine, PivotField.AutoSortPivotLine, PivotLines.Item and PivotAxis.PivotLines

For Each

Here is an example of processing the PivotLine items in a collection.

Dim pas As PivotAxis: Set pas = 
Dim pvtlnPivotLine As PivotLine
For Each pvtlnPivotLine In pas.PivotLines
Next pvtlnPivotLine


Returns an XlPivotLineType constant that indicates the type of PivotLine.

Possible Values are xlPivotLineBlank - Blank line after each group, xlPivotLineGrandTotal - Grand Total line, xlPivotLineRegular - Regular PivotLine with pivot items, xlPivotLineSubtotal - Subtotal line.


Returns the parent object for the specified PivotLine object. Read-only.


Returns a collection of PivotCell objects in a PivotLine.


Retrieves all the PivotLine cells including those that are hidden in compact form.


Returns or sets the position of the PivotLine object.


Returns the number of items in the PivotLines collection.


Returns a specific element of the PivotLines collection object by its position in the collection.

Syntax : expression.Item (Index)

Index: Specifies the position of an element of the collection.


Returns the parent object for the specified PivotLines object. Read-only.