I have written a code for creating pivot table. After this I want to add Chart which is linked to PT1 pivot table. and I should be able to give exact cell location where that chart should appear.
Can anyone help how to do it? Its kinda urgent!!!
Set data1 = ActiveWorkbook.PivotCaches.Create(xlDatabase, range("A1", Cells(B, A)).Address(, , xlR1C1))
Set PT1 = data1.CreatePivotTable(Worksheets("Tables").range("B3"))
Set PT1 = data1.CreatePivotTable(Worksheets("Tables").range("B83"))
With PT1
With .PivotFields("name")
.Orientation = xlRowField
.Position = 1
End With
With .PivotFields("Job type")
.Orientation = xlRowField
.Position = 2
End With
With .PivotFields("Multiple Bids")
.Orientation = xlColumnField
.Position = 1
End With
With .PivotFields("ASR Id")
.Orientation = xlDataField
.Function = xlCount
.Position = 1
.Caption = "Volume"
End With
With .PivotFields("Annual Cost")
.Orientation = xlDataField
.Function = xlSum
.Position = 2
.Caption = "Annual Sum"
End With
With PT1
.MergeLabels = True
.InGridDropZones = True
.RowAxisLayout xlTabularRow
.SmallGrid = True
.ShowTableStyleColumnHeaders = True
.LayoutRowDefault = xlTabularRow
End With
Can anyone help how to do it? Its kinda urgent!!!
Set data1 = ActiveWorkbook.PivotCaches.Create(xlDatabase, range("A1", Cells(B, A)).Address(, , xlR1C1))
Set PT1 = data1.CreatePivotTable(Worksheets("Tables").range("B3"))
Set PT1 = data1.CreatePivotTable(Worksheets("Tables").range("B83"))
With PT1
With .PivotFields("name")
.Orientation = xlRowField
.Position = 1
End With
With .PivotFields("Job type")
.Orientation = xlRowField
.Position = 2
End With
With .PivotFields("Multiple Bids")
.Orientation = xlColumnField
.Position = 1
End With
With .PivotFields("ASR Id")
.Orientation = xlDataField
.Function = xlCount
.Position = 1
.Caption = "Volume"
End With
With .PivotFields("Annual Cost")
.Orientation = xlDataField
.Function = xlSum
.Position = 2
.Caption = "Annual Sum"
End With
With PT1
.MergeLabels = True
.InGridDropZones = True
.RowAxisLayout xlTabularRow
.SmallGrid = True
.ShowTableStyleColumnHeaders = True
.LayoutRowDefault = xlTabularRow
End With