如何将VBA中的数组值显示到excel的嵌入式图表?
来源:百度知道 编辑:UC知道 时间:2024/06/20 00:55:14
With S
.Values = Y ''不知怎么开始出错
.XValues = X ''不知怎么开始出错
End With
.Values = Y ''不知怎么开始出错
.XValues = X ''不知怎么开始出错
End With
先将数组与excel中某一列对应
再对该列数做嵌入式图表。
运行就行了
Sub Test()
Dim S As Series
Dim X, Y
Set S = ActiveSheet.ChartObjects(1).Chart.SeriesCollection(1)
Y = Array(1, 2, 3, 4, 5)
X = Array("A", "B", "C", "D", "E")
With S
.Values = Y
.XValues = X
End With
End Sub