GiraffetheGeek
Board Regular
- Joined
- May 25, 2011
- Messages
- 58
Hi all,
I have a chart that it based on only 4 lines of data at present. However as time goes on the line of data will increase.
I have written some code to update the charts data source as below:
However when this code is run I get the following error:
"Run-time error '1004': Unable to set the Values property of the Series class"
I sorta got out of my depth with this but thought I might be able to teach myself something - guess not
I have a chart that it based on only 4 lines of data at present. However as time goes on the line of data will increase.
I have written some code to update the charts data source as below:
Code:
Sub FormatChart()
Sheets("ChartData").Select
Range("A1").Select
If ActiveCell <> "" Then
Do Until ActiveCell.Value = ""
ActiveCell.Offset(0, 1).Select
Loop
End If
ActiveCell.Offset(0, -1).Select
endrow = ActiveCell.Row
Sheets("Running Results").Select
ActiveSheet.ChartObjects("Chart 8").Activate
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection(1).Values = "='ChartData'!$B$1:$B$" & endrow
ActiveChart.SeriesCollection(2).Values = "='ChartData'!$E$1:$E$" & endrow
ActiveChart.SeriesCollection(3).Values = "='ChartData'!$H$1:$H$" & endrow
ActiveChart.SeriesCollection(4).Values = "='ChartData'!$K$1:$K$" & endrow
End Sub
However when this code is run I get the following error:
"Run-time error '1004': Unable to set the Values property of the Series class"
I sorta got out of my depth with this but thought I might be able to teach myself something - guess not