I'm writing a macro to create an XY Scatter chart in Excel 2010 but having some trouble. I am trying to assign .Name, .XValues, and .Value using a loop but whenever my macro completes there are several unneeded entries in the chart. Here is my code:
For m = 4 To 36
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(m).Name = Range("A" & m)
ActiveChart.SeriesCollection(m).XValues = Range("Q" & m)
ActiveChart.SeriesCollection(m).Values = Range("R" & m)
Next m
For some reason the first three series being added are M1:M2, N1:N2, and O1:O2 but I have no idea why. I only want data from columns A, Q, and R. Also at the bottom of the chart there are always ten addition series (e.g. Series1 through Series10). Does anyone know why this happening and what I can do to fix it?