I have a workbook that already contains numerous charts. I now want to add a new series to each chart. The source data for the new series will come from a worksheet in which the columns align with the charts. for example the first chart will use column B for its source, the second will use column C for its source and so on. All charts will use column A as the x axis data.
The code below works for the first chart but I can't figure out how to increment to the next columns for the remaining charts. Any ideas?
vb Code:
For Each oXLChart In oXLBookCurrent.Charts With oXLChart iRow = oXLSheetBase.UsedRange.Rows.Count With .SeriesCollection.NewSeries .XValues = oXLSheetBase.Range("A3:A" & iRow) .Values = oXLSheetBase.Range("B3:B" & iRow) 'This line needs to change .Name = aBase(iBase) .MarkerStyle = xlMarkerStyleNone End With End With Next




Reply With Quote