I have a chart which is updated via a VBA macro assigned to a developer button:
ActiveChart.SetSourceData Source:=Sheets("Tab1").Range("Range1")
The VBA references a named range (Range1) which uses OFFSET logic to reference the range of data needed, in the floowing way.
=OFFSET('data sheet'!$A$6,0,0, COUNTIF('data sheet'!$A$7:$A$506,">1")+1,COUNTIF('data sheet'!$A$3:$GT$3,"*"))
I now have need to add in more series to this chart and would like to add Range 2 to my chart but find that amending my VBA to the following is not working:
ActiveChart.SetSourceData Source:=Union(Sheets("Tab1").Range("Range1"),Sheets("Tab2").Range("Range2"))
ps, I have not included an example dataset here as all parts othe process use dynamic named ranges so a solution built on any nXn data grid should work here as long as variables are stored in column form
ActiveChart.SeriesCollection.NewSeries ActiveChart.FullSeriesCollection(23).Name = "='Tab2" ActiveChart.FullSeriesCollection(23).Values = _ "='Tab2'!$B$7:$B$201"- Joel B