我已经编写了使用两张表数据生成图表的代码。
代码是
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).XValues = "=SPEC!$B$2:$J$2"
ActiveChart.SeriesCollection(2).Values = "=SPEC!$B$6:$J$6"
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(3).Values = "=reference_curve!$D$4:$D$303"
ActiveChart.SeriesCollection(3).XValues = "=reference_curve!$C$4:$C$303"`
它工作正常,但问题是我想使用范围变量来选择数据。
dim test as range
test = "=SPEC!$B$6:$J$6"
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).XValues = "=SPEC!$B$2:$J$2"
ActiveChart.SeriesCollection(2).Values = test
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(3).Values = "=reference_curve!$D$4:$D$303"
ActiveChart.SeriesCollection(3).XValues = "=reference_curve!$C$4:$C$303"
这个不工作请帮帮我