gpt4 book ai didi

VBA添加图表标题

转载 作者:行者123 更新时间:2023-12-02 01:50:14 26 4
gpt4 key购买 nike

我只想使用 vba 将图表标题添加到我的图表中。我实际上想对每张纸中的每个图表递归地执行此操作,但我什至无法让 1 个图表工作。这是我的代码:

Dim chnam
chnam = Left(ActiveSheet.Name, (Len(ActiveSheet.Name) - 9))
With ActiveWorkbook.ActiveSheet.ActiveChart
.HasTitle = True
.ChartTitle = chnam
End With

这是我的图表:

enter image description here

当我运行代码时,我得到:

Object does not support this property or method

最佳答案

试试这个:

Dim chnam as string
chnam = Left(ActiveSheet.Name, (Len(ActiveSheet.Name) - 9))
With ActiveWorkbook.ActiveSheet.ActiveChart
.HasTitle = True
.ChartTitle.Select
.ChartTitle.Text = chnam
End With

关于VBA添加图表标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29616464/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com