PivotTable.DrillUp method (Excel)

Enables you to drill up into the data within an OLAP-based or PowerPivot-based cube hierarchy.

Syntax

expression.DrillUp (PivotItem, PivotLine, LevelUniqueName)

expression A variable that represents a PivotTable object.

Parameters

Name Required/Optional Data type Description
PivotItem Required PIVOTITEM The member from which the drill up is performed.
PivotLine Optional Variant Specifies the line in the PivotTable where the operation starting member resides. In cases where PivotLine is not specified, defaults to the top PivotLine where the member appears.
LevelUniqueName Optional Variant The target for a multi-level drill up. The default action, if not specified, is a one level drill up.

Return value

VOID

Example

The following sample code demonstrates a single-level drill up on a PivotTable.

ActiveSheet.PivotTables("PivotTable1").DrillUp ActiveSheet.PivotTables( _
      "PivotTable1").PivotFields("[Customer].[Customer Geography].[Postal Code]"). _
      PivotItems( _
      "[Customer].[Customer Geography].[Postal Code].&[2450]&[Coffs Harbour]"), _
      ActiveSheet.PivotTables("PivotTable1").PivotRowAxis.PivotLines(1)

The following sample code demonstrates a level drill up on a PivotChart.

ActiveChart.PivotLayout.PivotTable.DrillUp ActiveChart.PivotLayout.PivotTable. _
      PivotFields("[Customer].[Customer Geography].[Postal Code]").PivotItems( _
      "[Customer].[Customer Geography].[Postal Code].&[2450]&[Coffs Harbour]"), _
      ActiveChart.PivotLayout.PivotTable.PivotRowAxis.PivotLines(1)

The following sample code demonstrates a multi-level drill up on a PivotTable.

ActiveSheet.PivotTables("PivotTable1").DrillUp ActiveSheet.PivotTables( _
     "PivotTable1").PivotFields("[Customer].[Customer Geography].[City]").PivotItems _
     ("[Customer].[Customer Geography].[City].&[Coffs Harbour]&[NSW]"), ActiveSheet. _
     PivotTables("PivotTable1").PivotRowAxis.PivotLines(1), _
     "[Customer].[Customer Geography].[Country]"

The following sample code demonstrates a multi-level drill up on a PivotChart.

ActiveChart.PivotLayout.PivotTable.DrillUp ActiveChart.PivotLayout.PivotTable. _
     PivotFields("[Customer].[Customer Geography].[Postal Code]").PivotItems( _
     "[Customer].[Customer Geography].[Postal Code].&[2450]&[Coffs Harbour]"), _
     ActiveChart.PivotLayout.PivotTable.PivotRowAxis.PivotLines(1) , _
     "[Customer].[Customer Geography].[Country]"

Support and feedback

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.