excel vba - Error when accessing pivot table using VBA -


i have pivottable in excel looks this:

account                e-mail   sum of price    sum of billing price customer z             blah@gmail.com       30            33.75 customer z total                            30            33.75 customer y             blah@gmail.com       10            10.5 customer y total                            10            10.5 grand total                                 40              44.25 

i have following vba code:

for j = 2 pt.rowfields(1).pivotitems.count     sheets("configuration").range("j2").value = sheets("configuration").range("j2").value + 1      client = pt.rowfields("account").pivotitems(j)     sum = pt.getpivotdata("sum of billing price", "account", client)     net = pt.getpivotdata("sum of price", "account", client)     email = pt.rowfields("e-mail").pivotitems(j)     ... 

when run code, receive error: unable pivotitems property of pivotfield class when assigning value e-mail. assigning value client works expected. have tried using index numbers, same result.

it looks don't have emails in every row. may want put conditional statement in deal this.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -