I have a VBA macro in excel created in Excel 2007 that works fine in Excel 2007. However, when running in Excel 2003 it refuses to draw the chart and returns an error on the first line of the code below.
The macro runs fine up to this part about the graph:
Goal of this code:
This part of the macro tries to create a line chart on the worksheet "grafiek" with two lines: one with the values of column B and one with the values of column C. The values of column A needs to be on the x-axes.
However, the length of the columns varies, therefore the last rownumber of the range that need to be plotted is defined by the sum of the integers "Eind - Begin + 2". (Those "eind" and "begin" are defined earlier in the macro.)
If anyone knows what is non-2003 compatible or has another suggestion how to reach this goal, please let me know!
Thanks in advance.
The macro runs fine up to this part about the graph:
Code:
Sheets("grafiek").Shapes.AddChart.Select
ActiveChart.ChartType = xlLine
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Values = Sheets("grafiek").Range(Cells(2, 2), Cells(Eind - Begin + 2, 2))
ActiveChart.SeriesCollection(1).XValues = Sheets("grafiek").Range(Cells(2, 1), Cells(Eind - Begin + 2, 1))
Goal of this code:
This part of the macro tries to create a line chart on the worksheet "grafiek" with two lines: one with the values of column B and one with the values of column C. The values of column A needs to be on the x-axes.
However, the length of the columns varies, therefore the last rownumber of the range that need to be plotted is defined by the sum of the integers "Eind - Begin + 2". (Those "eind" and "begin" are defined earlier in the macro.)
If anyone knows what is non-2003 compatible or has another suggestion how to reach this goal, please let me know!
Thanks in advance.