bs0d
Well-known Member
- Joined
- Dec 29, 2006
- Messages
- 622
I'm using VBA to re-reference the max row reference for series on a chart in my 2013 Excel workbook.
This code works:
However, If possible, I don't want to activate and select the chart through the process. Here is my stab at it, which yields an error:
Is it possible to modify the chart series as I'm attempting without actually selecting the chart? If so, I'd like to see how. Thanks,
This code works:
Code:
Sheets("DASHBOARD").ChartObjects("Hist").Activate
ActiveChart.ChartArea.Select
ActiveChart.FullSeriesCollection(1).Values = "=Data!$H$2:$H$" & FinalRow
ActiveChart.FullSeriesCollection(2).Values = "=Data!$I$2:$I$" & FinalRow
ActiveChart.FullSeriesCollection(3).Values = "=Data!$J$2:$J$" & FinalRow
ActiveChart.FullSeriesCollection(4).Values = "=Data!$K$2:$K$" & FinalRow
Code:
With Sheets("DASHBOARD").ChartObjects("Hist").ChartArea
.FullSeriesCollection(1).Values = "=Data!$H$2:$H$" & FinalRow
.FullSeriesCollection(2).Values = "=Data!$I$2:$I$" & FinalRow
.FullSeriesCollection(3).Values = "=Data!$J$2:$J$" & FinalRow
.FullSeriesCollection(4).Values = "=Data!$K$2:$K$" & FinalRow
End With