Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Series Problem

Status
Not open for further replies.

aMember

Programmer
Jun 12, 2002
99
US
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top