简体   繁体   中英

Identify Pivot Field using VBA

I am trying to write a macro which automatically identifies which field is the data taken from in a pivot.

I have some columns with different level of org information dragged under one another in "Row Labels" to create a structure. Now I need to identify which row in the pivot is linked to which field.

I am a self-taught coder and am very new to advanced vba so need some help.

How my pivots look

我的支点看起来如何

I am trying to get the name of the field in the blue circle

我正在尝试在蓝色圆圈中获取字段的名称

Thank you!

Nevermind guys, It was simpler than I thought. I am just an idiot for not figuring it out earlier.

Anyhow, the solution is that "ActiveCell.PivotField" returns the Pivot row's field.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM