Sub AddChart()
Dim ch As ChartObject
Set ch = ActiveSheet.ChartObjects.Add(200, 200, 200, 200)
Dim chData As Range
Set chData = Range("B2:B13")
Dim chTitle As Range
Set chTitle = Range("C1")
With ch.Chart
.SetSourceData Source:=Sheets("2_Basisdata").Range("B1:B13")
.Charttype = xlColumnClustered
.HasTitle = True
.Charttitle = "chTitle"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Monate"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Werte"
End With
End Sub
必须解决的新问题:D 我必须从我的Basisdata工作表中选择一个特殊行,然后用它创建一个图表。
错误是运行时438 对象不支持属性或方法 holdmarker是at charttitle