Hi,
Is it possible to create the pivot table on one sheet and the chart of the same data on a different sheet?
Below is my code for creating the pivot table... but i don't know how to create my chart from there...
***************************************
Sub PivotType()
' Create pivot table for type of computers
Sheets("Inventaire").Select
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, _
SourceData:=ActiveSheet.UsedRange, Version:=xlPivotTableVersion15). _
CreatePivotTable TableDestination:="PivotTable!R2C1", TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion15
Sheets("PivotTable").Select
Cells(2, 1).Select
ActiveSheet.PivotTableWizard TableDestination:=ActiveSheet.Cells(2, 1)
ActiveSheet.PivotTables("PivotTable1").AddFields RowFields:="Type"
ActiveSheet.PivotTables("PivotTable1").PivotFields("Type").Orientation = xlDataField
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Type")
.Orientation = xlRowField
.Position = 1
End With
Range("A2").Select
ActiveSheet.PivotTables("PivotTable1").CompactLayoutRowHeader = "Type"
Range("B2").Select
ActiveSheet.PivotTables("PivotTable1").DataPivotField.PivotItems( _
"Count of Type").Caption = "Qty"
Range("B2").Select
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With