在条形图中选择系列名称和值

时间:2017-12-03 09:11:45

标签: vba excel-vba excel

请帮助修复代码并使其适用于为系列条形图选择的范围,第一个是系列名称,第二个是系列值

 Sheets("Or").cells(1, (c + b))
 Sheets("Or").Range(cells(2, (c + b)), cells(j, (c + b)))

这是完整的代码

  j = cells(2, 1)
  a = cells(2, 2) - 1

  For b = 1 To a

  Let c = Sheets("Or").Range("KJ4")

    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.FullSeriesCollection(b + 4).Name = Sheets("Or").cells(1, (c + b))
    ActiveChart.FullSeriesCollection(b + 4).Values = Sheets("Or").Range(cells(2, (c + b)), cells(j, (c + b)))
    ActiveChart.FullSeriesCollection(b + 4).AxisGroup = 1
    ActiveChart.FullSeriesCollection(b + 4).ChartType = xlColumnStacked

  Next

0 个答案:

没有答案