I have a premade chart (template) with very thin markers to make the data more aesthetic.
I'm trying to import data into my premade chart but only the first data series holds on to the thin markers. All the others are set to default. Code is attached.
I suspect that SetSourceData is setting the data which is why the first data series works as intended, but SeriesCollection(2) is overwriting my (premade) series 2. Has anyone ran into something like this?
Thanks in advance,
Tom
I'm trying to import data into my premade chart but only the first data series holds on to the thin markers. All the others are set to default. Code is attached.
I suspect that SetSourceData is setting the data which is why the first data series works as intended, but SeriesCollection(2) is overwriting my (premade) series 2. Has anyone ran into something like this?
Thanks in advance,
Tom
Code:
Sub Silver()
Dim n As Integer
Sheets(3).Activate
Range("D1").Formula = "=count(B:B)"
Range("I1").Formula = "=count(G:G)"
Range("N1").Formula = "=count(L:L)"
n = Range("D1").Value
ActiveSheet.Shapes.AddChart2(240, xlXYScatterLines).Select 'Add Chart
ActiveChart.ApplyChartTemplate ("C:\Users\tweglarz\AppData\Roaming\Microsoft\Templates\Charts\Reflections Chart.crtx")
ActiveChart.SetSourceData Source:=Range("B6:B" & n, "C6:C" & n)
n = Range("I1").Value
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).XValues = Range("g6:g" & n) ' Source X data
ActiveChart.SeriesCollection(2).Values = Range("h6:h" & n)
n = Range("N1").Value
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(3).XValues = Range("l6:l" & n) ' Source Y data
ActiveChart.SeriesCollection(3).Values = Range("m6:m" & n)
End Sub