Hi,
I have been struggling to add a loop function to add 107 series to a chart without manually adding in each one
The X and Y data are in Columns B2:B8882 and C2:8882 and each series I want to plot is 107 data points. Total 83 series.
Below is the code I have so far. it seems to work..ish but extremely slow. Does anybody know what I am doing wrong?
Any Help would be much appreciated!
First time posting here so hope I did it correctly
I have been struggling to add a loop function to add 107 series to a chart without manually adding in each one
The X and Y data are in Columns B2:B8882 and C2:8882 and each series I want to plot is 107 data points. Total 83 series.
Below is the code I have so far. it seems to work..ish but extremely slow. Does anybody know what I am doing wrong?
Any Help would be much appreciated!
Code:
Sub Plot()
'
' Plot Macro
'
'
' Keyboard Shortcut: Ctrl+Shift+P
'
'
Dim series$, sn%, counter As Long, lastrow As Long
ActiveSheet.Shapes.AddChart2(240, xlXYScatter).Select
ActiveChart.ApplyChartTemplate ( _
"C:\Users\fe\AppData\Roaming\Microsoft\Templates\Charts\reach.crtx")
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
counter = 0
Do Until Cells(2, 2).Offset(107, 0 * counter) = ""
sn = ActiveChart.SeriesCollection.Count
ActiveChart.SeriesCollection(sn).XValues = ActiveSheet.Range("B2:B" & lastrow).Offset(107, 0 * counter)
ActiveChart.SeriesCollection(sn).Values = ActiveSheet.Range("C2:C" & lastrow).Offset(107, 0 * counter)
counter = counter + 1
Loop
End Sub
First time posting here so hope I did it correctly