I have a macro to create a chart and modify its properties.
If I run the macro normally, I get
Run-time error '-2147024809 (80070057)':
The Item with the specified name wasn't found.
on the last line of this code
Set ChtObj = Worksheets("summary").ChartObjects.Add(Left:=700, Top:=100, Width:=800, Height:=500)
With ChtObj
.chart.ChartType = xlColumnStacked
.chart.SetSourceData Source:=Range("statistics!A101:C" & targetRow)
.Name = "waterfall"
End With
ActiveSheet.ChartObjects("waterfall").Activate
If I run the code step by step, I get no errors.