For some weird reason, when I run the macro I created at work, it doesn't behave like it should. My macro creates charts. When it goes through the code, all of a sudden it tells me that my chart doesn't have a title - but when I step into it (pressing F8), it works fine. This is the runtime error I get: '-2147024809 (80070057) This object has no title.
This is the code I have:
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range("'Annual_Sales'!$A$6:$D$10")
ActiveWorkbook.ShowPivotChartActiveFields = True
ActiveChart.ChartType = xlLineMarkers
ActiveChart.ChartStyle = 41
ActiveChart.ClearToMatchStyle
ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).ApplyDataLabels
ActiveChart.SeriesCollection(1).DataLabels.Select
Selection.Position = xlLabelPositionAbove
ActiveChart.SeriesCollection(1).DataLabels.NumberFormat = "$#,##"
ActiveChart.SeriesCollection(1).DataLabels.Font.Size = 12
ActiveChart.Legend.Select
Selection.Delete
ActiveChart.Axes(xlValue).Select
Selection.Delete
ActiveChart.ChartTitle.Characters.Text = "Yearly Sales"
Bookmarks