Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
pp pp is offline
external usenet poster
 
Posts: 10
Default Display format for Total Column of Pivot Table

Hi Folks

I created an Excel Pivot table. Programatically I set the format for the
fields in "ColumnFields" section (see code below).

'================================================= ====
'-- Formatting the look-n-feel of the Numbers displayed
'================================================= ==== Dim pvtField
For Each pvtField In pvtTable.ColumnFields '.DataFields
Select Case UCase(pvtField)
'===========================================
'Format USD with commas and 3 decimal places
'===========================================
Case "FY"
pvtTable.PivotSelect pvtField, xlDataOnly
Selection.NumberFormat = "0.000_);(0.000)"
Case "FM"
pvtTable.PivotSelect pvtField, xlDataOnly
Selection.NumberFormat = "0.000_);(0.000)"
End Select
Next pvtField

What I'm trying to do
=============
Display negative numbers in parenthesis


Question
======
The code works fine, it applies the required format , but it does not apply
the format to the TOTAL column. Is there something I'm missing in my code?

Thanks
PP
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Display format for Total Column of Pivot Table

Hi,
I recorded a quick macro to format the last Grand Total column; i ran the
code on another pivot and it worked fine.
ActiveSheet.PivotTables("PivotTable1").PivotSelect "'Row Grand Total'", _
xlDataOnly
Selection.NumberFormat = "#,##0_);(#,##0)"

i hope this helps,
Regards,
Sébastien


"PP" wrote:

Hi Folks

I created an Excel Pivot table. Programatically I set the format for the
fields in "ColumnFields" section (see code below).

'================================================= ====
'-- Formatting the look-n-feel of the Numbers displayed
'================================================= ==== Dim pvtField
For Each pvtField In pvtTable.ColumnFields '.DataFields
Select Case UCase(pvtField)
'===========================================
'Format USD with commas and 3 decimal places
'===========================================
Case "FY"
pvtTable.PivotSelect pvtField, xlDataOnly
Selection.NumberFormat = "0.000_);(0.000)"
Case "FM"
pvtTable.PivotSelect pvtField, xlDataOnly
Selection.NumberFormat = "0.000_);(0.000)"
End Select
Next pvtField

What I'm trying to do
=============
Display negative numbers in parenthesis


Question
======
The code works fine, it applies the required format , but it does not apply
the format to the TOTAL column. Is there something I'm missing in my code?

Thanks
PP

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot Table 2007 display field only in Grand Total M Masalha[_2_] Excel Discussion (Misc queries) 0 December 27th 09 04:24 AM
Total Column in Pivot Table kleivakat Excel Discussion (Misc queries) 5 December 7th 07 12:22 AM
Sub-Total Column in a pivot table dan Excel Discussion (Misc queries) 0 February 6th 07 04:54 PM
How do I display both a sum total and an average in pivot table? catarina_miguel Excel Worksheet Functions 3 October 11th 06 12:24 AM
Pivot table question: How to display total and percent for data simultaneouly [email protected] Excel Discussion (Misc queries) 1 January 18th 06 07:12 PM


All times are GMT +1. The time now is 04:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"