次のような Excel のピボットテーブルがあります。
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
私は次のVBAコードを持っています:
For j = 2 To 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)
...
コードを実行すると、次のエラーが表示されます:Unable To Get PivotItems Property Of PivotField Class
電子メールに値を割り当てるとき。クライアントへの値の割り当ては期待どおりに機能します。インデックス番号も使用してみましたが、同じ結果になりました。