Hi All,
i am using below code to create a Pivot table from Macro.
My macro creates around 40-50 pivot tables for several branches.
Using the same data , if I create a pivot table Pivot data field count is 134.
But, if the Pivot is created using macro at run time, value is 72.
I checked if we have duplicate in amounts , but no duplicates found.
I removed few other branches data from my source and ran macro, this time macro created table have the field count as 134.
Below is my sample code :
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, _
SourceData:=DataRange, TableDestination:=Destination, TableName:="Volume"
ActiveSheet.PivotTables("Volume").AddDataField ActiveSheet.PivotTables( _
"Volume").PivotFields("Amount"), "Count of Amount", xlCount
This is a bit surprising for me as count returns invalid data when we have several branches (20-40) data and Pivot works really when Source has 3-4 branches data.
Please assist , if I can change any settings or something to get this fixed.
Thanks very much
i am using below code to create a Pivot table from Macro.
My macro creates around 40-50 pivot tables for several branches.
Using the same data , if I create a pivot table Pivot data field count is 134.
But, if the Pivot is created using macro at run time, value is 72.
I checked if we have duplicate in amounts , but no duplicates found.
I removed few other branches data from my source and ran macro, this time macro created table have the field count as 134.
Below is my sample code :
ActiveSheet.PivotTableWizard SourceType:=xlDatabase, _
SourceData:=DataRange, TableDestination:=Destination, TableName:="Volume"
ActiveSheet.PivotTables("Volume").AddDataField ActiveSheet.PivotTables( _
"Volume").PivotFields("Amount"), "Count of Amount", xlCount
This is a bit surprising for me as count returns invalid data when we have several branches (20-40) data and Pivot works really when Source has 3-4 branches data.
Please assist , if I can change any settings or something to get this fixed.
Thanks very much