View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
[email protected] seanswilson@gmail.com is offline
external usenet poster
 
Posts: 5
Default Pivot Table Macro not inserting all data fields

I recorded a macro of me creating and populating a pivot table.
However, when I then run the macro, it is not fully poplulating the
pivot table. The code recorded for the macro is as follows:

ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:=
_
"Oct!R1C1:R59C12").CreatePivotTable TableDestination:= _
"'[DCs Issued_2006.xls]Oct'!R63C2", TableName:="PivotTable9",
DefaultVersion _
:=xlPivotTableVersion10
ActiveWindow.SmallScroll Down:=20
With ActiveSheet.PivotTables("PivotTable9").PivotFields ("Funder")
.Orientation = xlRowField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable9").AddDataFiel d
ActiveSheet.PivotTables( _
"PivotTable9").PivotFields("Funder"), "Count of Funder",
xlCount
ActiveSheet.PivotTables("PivotTable9").AddDataFiel d
ActiveSheet.PivotTables( _
"PivotTable9").PivotFields("Price"), "Sum of Price", xlSum
With ActiveSheet.PivotTables("PivotTable9").PivotFields ("Status")
.Orientation = xlRowField
.Position = 2
End With

When created, the pivot table has the following columns:

Funder, Status, Data (Count and Sum), Total

However, when I run the macro I just recorded, I get the following
columns:

Data (Count and Sum), Status, Total

For some reason, it does not seem to add the second Funder column when
the macro is run. Any suggestions on what could be wrong.