I am trying to create a chart from pivot table but I am getting an error. My code is given below:
Sub Chart()
'
' chart Macro
Dim shp As Chart
'
Set shp = Charts.Add
Worksheets("pivot").Select
Range("B5:E5").Select
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Range("Pivot!$A$3:$E$5")
ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="Tools Sold"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Consolidated"
ActiveSheet.Shapes("charts").LockAspectRatio = msoTrue
ActiveChart.ShowValueFieldButtons = False
ActiveSheet.ChartObjects("charts").Activate
ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).ApplyDataLabels
ActiveChart.SeriesCollection(2).Select
ActiveChart.SeriesCollection(2).ApplyDataLabels
ActiveChart.SeriesCollection(3).Select
ActiveChart.SeriesCollection(3).ApplyDataLabels
End With
End Sub
I got a run time error when I debugging line
ActiveSheet.Shapes("charts").LockAspectRatio = msoTrue
I am a beginner. So not be able to resolve this issue. I am also attached the error screenshot and the line.
How to resolve this issue? 
ShapeObject? I thought they were referred to asChartObjectsas inChartObjects("Chart 1")?LockAspectRatio(and I couldn't find a way on the quick to do the same with the Chart Object)