Excel Chart has no title error

别说谁变了你拦得住时间么 提交于 2020-05-27 04:14:33

问题


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!


回答1:


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"


来源:https://stackoverflow.com/questions/25789077/excel-chart-has-no-title-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!