T
ToddEZ
I used the Macro Recorder to create the following code to generate a Pivot
Table. When I try to run it I get the following error: "AddFeilds method of
Pivot Table Class Failed".
Any ideas how to make this work?
Sheets("Allocation").Select
Cells.Select
Application.CutCopyMode = False
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"Allocation!C1:C6").CreatePivotTable TableDestination:= _
"'[Conversion Workbook.xls]Allocation'!R1C8",
TableName:="PivotTable1", _
DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTables("PivotTable1").AddFields
RowFields:=Array("Social Security Number", "Source Name"),
ColumnFields:="Fund Name"
ActiveSheet.PivotTables("PivotTable1").PivotFields("Cash").Orientation = _
xlDataField
Range("H4").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Social Security
Number"). _
Subtotals = Array(False, False, False, False, False, False, False,
False, False, False, _
False, False)
Range("J5").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Count of
Cash").Function = _
xlSum
End Sub
Table. When I try to run it I get the following error: "AddFeilds method of
Pivot Table Class Failed".
Any ideas how to make this work?
Sheets("Allocation").Select
Cells.Select
Application.CutCopyMode = False
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"Allocation!C1:C6").CreatePivotTable TableDestination:= _
"'[Conversion Workbook.xls]Allocation'!R1C8",
TableName:="PivotTable1", _
DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTables("PivotTable1").AddFields
RowFields:=Array("Social Security Number", "Source Name"),
ColumnFields:="Fund Name"
ActiveSheet.PivotTables("PivotTable1").PivotFields("Cash").Orientation = _
xlDataField
Range("H4").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Social Security
Number"). _
Subtotals = Array(False, False, False, False, False, False, False,
False, False, False, _
False, False)
Range("J5").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Count of
Cash").Function = _
xlSum
End Sub