HELP! Formating all numbers in a OWC pivottable to display two decimal points.

M

mrwoopey

Hi,

When I view my data in a OWC pivottable, some of my numbers have two
decimal places and other only have one. Basically, the second decimal
place, if it is a zero it is dropped. So, when a user sorts, it does
not look right because there are some numbers with two decimals and
some with one.

I can change this via "command options" under text formatting, under
number. If I change this value to "fixed" then all my numbers have two
decimal places.

So, how can I do this via code?

I know that there is a NumberFormat property but it seems that you
need to explicitly say what column you want the formatting.

For example:

pivottable.ActiveView.Totals("Store Sales").NumberFormat = "$#,##0.00"

So, how can I format all numbers that have decimals to show two
decimal places?
For example, I wish I could do this:
pivottable.ActiveView.NumberFormat = "#,###.##"

Please post (my email is full with spam!)

Thanks,

Phin
 
M

Michael Weiss

Hi Phinn,
If you have a variable called pview and set it to your
pivot table control, the following code should get you
what you need:
dim pview
dim ttl
set pview = mypivottablecomponent
for each ttl in pview.totals
ttl.numberformat = "#0.00"
next

Other formats you can use if you need too are things
like "#,##0.00" and so forth.
Hope this helps,
Michael
 

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