Tuesday, 22 March 2016

How to Know the Pivot Field Orientation in Excel Pivot Table with VBA

Excel VBA to get the Pivot Field Orientation in a Pivot Table
Sub Pvt_Fields_Orientation()

Dim Pvt As PivotTable
Dim Pvt_Field As PivotField

Set Pvt = ActiveSheet.PivotTables("MyPivot")

For Each Pvt_Field In Pvt.PivotFields

MsgBox Pvt_Field.Name
MsgBox Pvt_Field.Orientation
'0-xlDataField (Values Section)
'1-xlRowField (Row Section)
'2-xlColumnField (Column Section)
'3-xlPageField (Filter Section )

Next Pvt_Field

End Sub

Example :




No comments:

Post a Comment

Follow Me by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts