Edmond
01-15-2019, 01:28 PM
Hi there,
I am facing some issue when I want to automate the update of a chart.
I am updating those charts once a week, and want the last 10 weeks (explaining the offset).
I have this code, which works, but I would like to know if there is a "simpliest/more elegant" way to proceed.
wsWar.ChartObjects("Chart 4").ActivateActiveChart.SeriesCollection(1).Values = Range(Cells(35, 6).End(xlToRight).Offset(0, -9), Cells(35, 6).End(xlToRight)) ActiveChart.SeriesCollection(1).XValues = Range(cellweek, cellweek.Offset(0, -9))
ActiveChart.SeriesCollection(1).Name = "='Warehouse Charts'!$A$5"
ActiveChart.SeriesCollection(2).Values = Range(Cells(36, 6).End(xlToRight).Offset(0, -9), Cells(36, 6).End(xlToRight))
ActiveChart.SeriesCollection(2).XValues = Range(cellweek, cellweek.Offset(0, -9))
ActiveChart.SeriesCollection(2).Name = "='Warehouse Charts'!$A$6"
ActiveChart.SeriesCollection(3).Values = Range(Cells(37, 6).End(xlToRight).Offset(0, -9), Cells(37, 6).End(xlToRight))
ActiveChart.SeriesCollection(3).XValues = Range(cellweek, cellweek.Offset(0, -9))
ActiveChart.SeriesCollection(3).Name = "='Warehouse Charts'!$A$7"
Thanks in advance for your help!
I am facing some issue when I want to automate the update of a chart.
I am updating those charts once a week, and want the last 10 weeks (explaining the offset).
I have this code, which works, but I would like to know if there is a "simpliest/more elegant" way to proceed.
wsWar.ChartObjects("Chart 4").ActivateActiveChart.SeriesCollection(1).Values = Range(Cells(35, 6).End(xlToRight).Offset(0, -9), Cells(35, 6).End(xlToRight)) ActiveChart.SeriesCollection(1).XValues = Range(cellweek, cellweek.Offset(0, -9))
ActiveChart.SeriesCollection(1).Name = "='Warehouse Charts'!$A$5"
ActiveChart.SeriesCollection(2).Values = Range(Cells(36, 6).End(xlToRight).Offset(0, -9), Cells(36, 6).End(xlToRight))
ActiveChart.SeriesCollection(2).XValues = Range(cellweek, cellweek.Offset(0, -9))
ActiveChart.SeriesCollection(2).Name = "='Warehouse Charts'!$A$6"
ActiveChart.SeriesCollection(3).Values = Range(Cells(37, 6).End(xlToRight).Offset(0, -9), Cells(37, 6).End(xlToRight))
ActiveChart.SeriesCollection(3).XValues = Range(cellweek, cellweek.Offset(0, -9))
ActiveChart.SeriesCollection(3).Name = "='Warehouse Charts'!$A$7"
Thanks in advance for your help!