LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Pivot Table Programming

I want to programmatically change all "Sum of" fields in my pivot table to
"Average of" fields.

For example, I have a field called cquire.
The following code will show Acquire, but not Sum of Acquire.
Any help would be appreciated.

Sub PivotFields()
For Each pf In ActiveSheet.PivotTables("Pivottable2").PivotFields
On Error Resume Next
pf.ShowAllItems = True
Debug.Print pf.Name, pf.Caption, pf.SourceName
Next pf
End Sub

produces this output

Date Date Date
Action Action Action
Budget Budget Budget
Acquire Acquire Acquire
Dispense Dispense Dispense
Comments Comments Comments
Net Net Net
Data Data Error 2042

The following macro successfully accesses SUm of Acquire
Sub Pivot()

Debug.Print ActiveSheet.PivotTables("PivotTable2").PivotFields ("Sum of
Acquire").Name _
, ActiveSheet.PivotTables("PivotTable2").PivotFields ("Sum of
Acquire").Caption _
, ActiveSheet.PivotTables("PivotTable2").PivotFields ("Sum of
Acquire").SourceName

End Sub
producing the following output

Sum of Acquire Sum of Acquire Acquire

Any help would be appreciated.

Thanks.


 
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
how to create pivot table from existing pivot table in excel 2007 Udayraj Dhulekar Excel Discussion (Misc queries) 2 July 8th 13 08:22 PM
Excel Food Price Table, Programming, Is This Table All Right? Davi Excel Discussion (Misc queries) 2 June 3rd 07 12:24 PM
Pivot Table Programming OrrLyfe Excel Programming 3 November 1st 04 12:44 AM
Pivot table Programming Kris Excel Programming 1 October 5th 04 09:03 PM
VBA Programming with Pivot Tables no1uknow Excel Programming 1 September 23rd 03 12:52 AM


All times are GMT +1. The time now is 08:01 AM.

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"