AnswerSeeker
04-19-2012, 09:44 PM
Hello, I have a chart in Worksheets(2) which I like to update after finishing the calculations. The new data is added as new row below the previous data. The source is in another worksheet called "Statistics" and the chart in Worksheet(2).
my idea so far:
Sub Chart()
Dim FinalRow As Integer
FinalRow = Worksheets("Statistics").Range("A3").Value + 2
Worksheets(2).Activate
Worksheets(2).ChartObjects("MyStatistics").Activate
With ActiveChart
.SeriesCollection(1).SetSourceData Source:=Range(Worksheets("Statistics").Range("B3"), Worksheets("Statistics").Range("B" & FinalRow))
.SeriesCollection(2).SetSourceData Source:=Range(Worksheets("Statistics").Range("D3"), Worksheets("Statistics").Range("D" & FinalRow))
End With
End Sub
my idea so far:
Sub Chart()
Dim FinalRow As Integer
FinalRow = Worksheets("Statistics").Range("A3").Value + 2
Worksheets(2).Activate
Worksheets(2).ChartObjects("MyStatistics").Activate
With ActiveChart
.SeriesCollection(1).SetSourceData Source:=Range(Worksheets("Statistics").Range("B3"), Worksheets("Statistics").Range("B" & FinalRow))
.SeriesCollection(2).SetSourceData Source:=Range(Worksheets("Statistics").Range("D3"), Worksheets("Statistics").Range("D" & FinalRow))
End With
End Sub