Tuesday, March 22, 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 :



--------------------------------------------------------------------------------------------------------
Thanks, TAMATAM ; Business Intelligence & Analytics Professional
--------------------------------------------------------------------------------------------------------

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. If you wish, please share your genuine Feedback or comments only related to this Blog Posts. It is my humble request that, please do not post any Spam comments or Advertising kind of comments, which will be Ignored.