ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro to create pivotchart problems (https://www.excelbanter.com/excel-discussion-misc-queries/262297-macro-create-pivotchart-problems.html)

seed

Macro to create pivotchart problems
 
Put together a quick macro to assemble a pivotchart, nothing fancy just ran
through it recording and tried to run it on the same data afterwards, and
have come upon this error:

Run-time error '1004':
Unable to get the PivotFields property of the pivottable class

When I go to debug, the error is occurring at the asterisked line:

Cells.Select
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData:= _
"'Check results'!C1:C5").CreatePivotTable TableDestination:="",
TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion10
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(3, 1)
ActiveSheet.Cells(3, 1).Select
Charts.Add
ActiveChart.Location Whe=xlLocationAsNewSheet
* With ActiveChart.PivotLayout.PivotTable.PivotFields("TE ST_LOCATION")
.Orientation = xlPageField
.Position = 1
End With

Is there a workaround? Something I've missed?

Thanks,

Ryan


All times are GMT +1. The time now is 05:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com