View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Joerg Mochikun Joerg Mochikun is offline
external usenet poster
 
Posts: 104
Default How to determine order of row fields in pivot table

Found it myself: 'Position property ' is the answer
Joerg

"Joerg Mochikun" wrote in message
...
I need to determine the order of row fields in any given pivot table.
Problem: I don't know how.

For an example please refer to http://www.cpearson.com/excel/pivots.htm on
C.Pearson's site.

Database fields: Who Week What Amount. The example pivot table has 3 row
fields:Who Week What.

I can address the row fields:

ActiveSheet.PivotTables(1).RowFields(1).name = Who

ActiveSheet.PivotTables(1).RowFields(2).name = Week

ActiveSheet.PivotTables(1).RowFields(3).name = What

I found that the indexes of RowFields are NOT determined by the order in
which the row fields appear in the pivot table, but rather by the order of
their appearance in the database. So when I switch the row fields in the
pivot table to What Week Who, the leftmost row field in the resulting
pivot table (What) must still be referred to as RowFields(3), not
RowFields(1).

As a user can freely rearrange row fields of a pivot table, is there any
method to determine the actual order of these fields?

Thanks for any suggestion

Joerg Mochikun