How to specify a cell format for pivot data field?

A

Ai_Jun_Zhang

Hi!

I am using vba to create pivot table via ADO using data from access db
Here is my data field


objMyPivotTable.PivotFields("Salary").Orientation
xlDataField


If I would like my data field has the format of "#, ##0" - that mean
no decimal, I am not sure how should I do that?

Please advise.

Aijun
 
R

Rowan

Have you tried:

objMyPivotTable.PivotFields("Salary").NumberFormat = "#,##0"

Regards
Rowan
 
A

Ai_Jun_Zhang

Hi! Rowan,

I figured it out. It has to add "sum of" before the Salary

objMyPivotTable.PivotFields("sum of " + "Salary").NumberFormat =
"#,##0"


Thanks,

Aijun.
 

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