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 :
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 :
--------------------------------------------------------------------------------------------------------
Thanks, TAMATAM ; Business Intelligence & Analytics Professional
--------------------------------------------------------------------------------------------------------
Thanks, TAMATAM ; Business Intelligence & Analytics Professional
--------------------------------------------------------------------------------------------------------