I'm working with VBA trying to make charts. The chart is created like it should, but when I try to define a title, I get this error: "run time error '-2147024809 (80070057): this object has no title."
my VBA line is:
ActiveChart.ChartTitle.Text = "From " & Cells(Start, Prev) & " To " & Cells(Start, Op) & " - Recomended Setup: 0"
Does anyone has any idea why It's not working? (the same line worked on another chart already...) Thank you!
Click on the DESIGN tab. Open the drop-down menu named Add Chart Element in the Chart Layouts group. If you work in Excel 2010, go to the Labels group on the Layout tab. Choose 'Chart Title' and the position where you want your title to display.
In the formula bar, type an equal sign (=). In the worksheet, select the cell that contains the data that you want to display in the title, label, or text box on the chart. Press ENTER.
That is because you need to create the title before you can set it. Add this line before your code
ActiveChart.HasTitle = True
ActiveChart.ChartTitle.Text = "From " & Cells(Start, Prev) & _
" To " & Cells(Start, Op) & _
" - Recomended Setup: 0"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With