|
发表于 2014-7-26 15:13
|
显示全部楼层
本楼为最佳答案
- Sub ChartCreate()
- '必须将数组转换成像这样的 "={1,2,3,4,5,6,7}" String格式, 再用Values=这个string
- Dim A() As Variant
- A = Array(1, 2, 3, 4, 5, 6, 7) '定义数组并赋值
- For i = LBound(A) To UBound(A) '将数组转换成String格式
- str_A = str_A & A(i) & ","
- Next
- str_A = "={" & Left(str_A, Len(str_A) - 1) & "}"
- Charts.Add '添加Chart
- ActiveChart.ChartType = xlColumnClustered
- ActiveChart.SeriesCollection.NewSeries '添加系列
- ActiveChart.SeriesCollection(1).Values = str_A
- End Sub
复制代码 |
|