I created a macro designing a pivot table.
when i copy the code into the VB application the pivot table shows a count instead of a sum!!!

Any ideas why?

Cheers

I created a macro designing a pivot table.
when i copy the code into the VB application the pivot table shows a count instead of a sum!!!

Any ideas why?

Cheers

Hmn, Post the relevant code?

Good idea - Sorry!!!


xlApp.ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:="Sheet1!R1C1:R14C3").CreatePivotTable TableDestination:=xlApp.Range("E10"), TableName:="PivotTable2"
xlApp.ActiveSheet.PivotTables("PivotTable2").SmallGrid = False
With xlApp.ActiveSheet.PivotTables("PivotTable2").PivotFields("Event Date")
.Orientation = xlRowField
.Position = 1
End With
With xlApp.ActiveSheet.PivotTables("PivotTable2").PivotFields("Product")
.Orientation = xlColumnField
.Position = 1
End With
With xlApp.ActiveSheet.PivotTables("PivotTable2").PivotFields("Cost")
.Orientation = xlDataField
.Position = 1
End With
xlSheet.Application.CommandBars("PivotTable").Visible = False
xlSheet.Range("G16").Select

And You Paste that whole thing into VB?