繁体   English   中英

Excel VBA-Set SeriesCollection = 2D数组

[英]Excel VBA - Set SeriesCollection = 2D array

我有一个二维数组如下

Dim plot() As Double
ReDim plot(0 to 1, 0 to arryLength) ' arryLength is some integer value

尺寸“ 0”是指绘图的x轴值,尺寸“ 1”是指y轴值。 我需要使用此数组来设置现有图上的值。 我知道使用一维数组可以做类似的事情

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).XValues = xaxis()
ActiveChart.SeriesCollection(1).Values = yaxis()

如何设置.XValues = plot(@ Dimension 0).Values = plot(@ Dimension 1)

也许:

With ActiveSheet.ChartObjects("chart 1").Chart
    .SeriesCollection(1).XValues = Application.Transpose(Application.Index(plot, 0, 1))
    .SeriesCollection(1).Values = Application.Transpose(Application.Index(plot, 0, 2))
End With

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM