PDA

View Full Version : VBA iteration through pivot table



rookie
06-12-2011, 06:33 AM
Greetings,

I have a pivot table that I want to reproduce 140 times with different fields in it. The data source is the same for all 140 pivot tables.

Ok so in the pivot table field list box, I have different fields(144 of them). Is there a way to reference these fields in a code so that I can loop through it to produce different pivot tables? It basically needs to start from the first field till the last field.

Additional Info:

In the pivot table field list box: I am dragging three fields into three boxes below.

One field in the row labels box
one field in the column labels box, and
one field in the values box.

The fields in the column labels box as well as the values box remains the same for all 140 pivot tables. The only field changing is the field in the row labels box.

I am using Office 2010.


Thanks

Bradley123
06-22-2011, 11:23 PM
I read you matter carefully and in my point of view there is no reference to field in the code but i am searching in it which i discussed with you later.

rookie
06-23-2011, 02:47 AM
I read you matter carefully and in my point of view there is no reference to field in the code but i am searching in it which i discussed with you later.

One way that I thought of is indexing the field list before creating the pivot table.. eg, from 1 to 144. then have a code iterating (maybe a do loop?) through it, for i =1, i = i +1 . something like that.

What do you think