Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pivot Table Error
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:=xlDatab ase, 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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pivot Table Error
The SourceData is "Allocation!C1:C6" which doesn't look right for a
pivot table source. If you change that to the correct range, perhaps the macro will run correctly. ToddEZ wrote: 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:=xlDatab ase, 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 -- Debra Dalgleish Contextures http://www.contextures.com/tiptech.html |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Pivot Table Error | Charts and Charting in Excel | |||
Pivot Table #Name? error | Excel Discussion (Misc queries) | |||
Pivot Table error (424) | Excel Programming | |||
Pivot table error | Excel Discussion (Misc queries) | |||
Pivot Table Error | Excel Programming |