Creating pivot table dynamically

G

groupie

Hi,
I have a list of fields in a string and woudl liek to create a pivot
table from them, but am not sure how to proceed.
The fields are in a string with a , delimitor but I have also parsed
them into an array in case I could do it that way:

sPageFields = "field1, field2, field 3, field4"
Arr = SplitMultiDelims(sPageFields, ",") 'arr[0] = field1, arr
[1] = field2, etc...

' --> how to populate?::
oPT.AddFields RowFields:="Data", PageFields:=Array(" & Arr(iLoop)
& ")
or
oPT.AddFields RowFields:="Data", PageFields:=Array(" & sPageFields
& ")

Thanks!
 
P

Patrick Molloy

I don't think you can do it that way, after all, a pivot table is based off
underlying data.

You need to put the data into a table first then assign the table to a
PivotCache and from the cache create the pivot table
 
G

groupie

I don't think you can do it that way, after all, a pivot table is based off
underlying data.

You need to put the data into a table first then assign the table to a
PivotCache and from the cache create the pivot table




Hi,
I have a list of fields in a string and woudl liek to create a pivot
table from them, but am not sure how to proceed.
The fields are in a string with a , delimitor but I have also parsed
them into an array in case I could do it that way:
sPageFields = "field1, field2, field 3, field4"
   Arr = SplitMultiDelims(sPageFields, ",")    'arr[0] = field1, arr
[1] = field2, etc...
' --> how to populate?::
   oPT.AddFields RowFields:="Data", PageFields:=Array(" & Arr(iLoop)
& ")
or
   oPT.AddFields RowFields:="Data", PageFields:=Array(" & sPageFields
& ")
Thanks!- Hide quoted text -

- Show quoted text -

Hi,
Thanks for the reply.
Would you have an example of that? Don't see anything on Google.

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top