View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
seed seed is offline
external usenet poster
 
Posts: 27
Default 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