I am using a simple for loop to go through a set of data and add a series of data to a chart. However, if a blank row is left in the data the chart is not produceed correctly.
Here is the original code that works when all data is filled in.
'Addition of Data Series
For i = 1 To NoOfLines
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(i).XValues = Worksheets(i + 1 + NoOfFields).[I3:I500]
ActiveChart.SeriesCollection(i).Values = Worksheets(i + 1 + NoOfFields).[L3:L500]
ActiveChart.SeriesCollection(i).Name = Worksheets(i + 1 + NoOfFields).Cells(1, 1)
Next
I've tried putting in If statements to remove the series with no data but it doesn't work.
Any help would be awesome!!
Here is the original code that works when all data is filled in.
'Addition of Data Series
For i = 1 To NoOfLines
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(i).XValues = Worksheets(i + 1 + NoOfFields).[I3:I500]
ActiveChart.SeriesCollection(i).Values = Worksheets(i + 1 + NoOfFields).[L3:L500]
ActiveChart.SeriesCollection(i).Name = Worksheets(i + 1 + NoOfFields).Cells(1, 1)
Next
I've tried putting in If statements to remove the series with no data but it doesn't work.
Any help would be awesome!!