Hi all,
This is my code. It's supposed to change the XValues as well as Values property of a series of charts (nmbrObjects + 1). The code generates a runtime error in the bold part.
Funny thing is that it doens't do so for x = 2, it starts when x = 3. Apparently it's something to do with the particular chart that is activated when x = 3.
Any clues?
This is my code. It's supposed to change the XValues as well as Values property of a series of charts (nmbrObjects + 1). The code generates a runtime error in the bold part.
Funny thing is that it doens't do so for x = 2, it starts when x = 3. Apparently it's something to do with the particular chart that is activated when x = 3.
Any clues?
Rich (BB code):
For x = 2 To nmbrObjects + 1
OBJECTCOLUMN = Sheets("LookupData").Cells(5, x).Value
Yield = 100 * (Sheets("CLEAN_DATA_PER_DATE").Cells(LAST, OBJECTCOLUMN).Value / Sheets("CLEAN_DATA_PER_DATE").Cells(FIRST, OBJECTCOLUMN).Value - 1)
ActiveSheet.ChartObjects("Chart " & x - 1 & "").Activate
With ActiveChart
.ChartArea.Select
.SeriesCollection(1).XValues = _
"=CLEAN_DATA_PER_DATE!R" & FIRST & "C77:R" & LAST & "C77"
.SeriesCollection(1).Values = _
"=CLEAN_DATA_PER_DATE!R" & FIRST & "C" & OBJECTCOLUMN & ":R" & LAST & "C" & OBJECTCOLUMN & ""
.ChartTitle.Characters.Text = Sheets("LookupData").Cells(2, x).Value & " " & WorksheetFunction.Round(Yield, 2) & "%"
End With
Next