Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pivot Table Error L Charts and Charting in Excel 0 August 8th 07 04:20 PM
Pivot Table #Name? error Dave Excel Discussion (Misc queries) 2 July 26th 07 02:22 PM
Pivot Table error (424) GDCross Excel Programming 0 May 29th 06 06:34 PM
Pivot table error gramos14 Excel Discussion (Misc queries) 0 March 2nd 05 03:53 PM
Pivot Table Error Linda Excel Programming 1 December 2nd 03 04:37 PM


All times are GMT +1. The time now is 10:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"