Having problems with modifying a series through VBA.
Can anyone see why
"Unable to set the Values Property of the Series Class"
would occur on the line:
ActiveChart.SeriesCollection(i).Values = DataWindow
Using Excel 97 on NT4.0
-----------------------------
ActiveSheet.ChartObjects("Chart 1".Activate
Dim DateWindow As Range
FirstInWindow = Sheets("Data".Cells(DateRow, OldestMonthCol).Address
LastInWindow = Sheets("Data".Cells(DateRow, NewestMonthCol).Address
Set DateWindow = Sheets("Data".Range(FirstInWindow, LastInWindow)
Dim DataWindow As Range
For i = 1 To ActiveChart.SeriesCollection.Count
Select Case i
Case 1
theRow = Sheets("Data".Range("CPIData".Row
Case 2
theRow = Sheets("Data".Range("SPIData".Row
Case 3
theRow = Sheets("Data".Range("BACEAC4Data".Row
End Select
'set the range for the window of dates in view
FirstInWindow= Sheets("Data".Cells(theRow, OldestMonthCol).Address
LastInWindow= Sheets("Data".Cells(theRow, NewestMonthCol).Address
Set DataWindow = Sheets("Data".Range(FirstInWindow, LastInWindow)
ActiveSheet.ChartObjects(1).Activate
ActiveChart.SeriesCollection(i).Values = DataWindow
ActiveChart.SeriesCollection(i).XValues = DateWindow
Next i
Can anyone see why
"Unable to set the Values Property of the Series Class"
would occur on the line:
ActiveChart.SeriesCollection(i).Values = DataWindow
Using Excel 97 on NT4.0
-----------------------------
ActiveSheet.ChartObjects("Chart 1".Activate
Dim DateWindow As Range
FirstInWindow = Sheets("Data".Cells(DateRow, OldestMonthCol).Address
LastInWindow = Sheets("Data".Cells(DateRow, NewestMonthCol).Address
Set DateWindow = Sheets("Data".Range(FirstInWindow, LastInWindow)
Dim DataWindow As Range
For i = 1 To ActiveChart.SeriesCollection.Count
Select Case i
Case 1
theRow = Sheets("Data".Range("CPIData".Row
Case 2
theRow = Sheets("Data".Range("SPIData".Row
Case 3
theRow = Sheets("Data".Range("BACEAC4Data".Row
End Select
'set the range for the window of dates in view
FirstInWindow= Sheets("Data".Cells(theRow, OldestMonthCol).Address
LastInWindow= Sheets("Data".Cells(theRow, NewestMonthCol).Address
Set DataWindow = Sheets("Data".Range(FirstInWindow, LastInWindow)
ActiveSheet.ChartObjects(1).Activate
ActiveChart.SeriesCollection(i).Values = DataWindow
ActiveChart.SeriesCollection(i).XValues = DateWindow
Next i