0

Dear experts,

I´m in trouble with this project. Strange 'cause the same code works on a different workbook.
Can you guys help me, plz?

Sub Graph()

Dim y As Byte
Dim x As Byte
Dim a As Byte
Dim D As Integer

x = 0
y = 5

Workbooks("Graph1.xls").Activate
Worksheets("Plan1").Select

With ActiveSheet.ChartObjects("Graph 26").Activate

Do Until ActiveChart.SeriesCollection.Count = 0
ActiveChart.SeriesCollection(1).Delete
Loop

End With

Worksheets("Plan1").Select
a = Worksheets("Plan1").Range("U6")
a = a + 3


With ActiveChart

Do Until a = y

y = y + 1
D = y
x = y - 5

.SeriesCollection.NewSeries
.SeriesCollection(x).Name = Plan1.Cells(D, 18).Value
.SeriesCollection(x).Values = Plan1.Cells(D, 19).Value
.SeriesCollection(x).XValues = Plan1.Cells(D, 20).Value

Loop

End With

End Sub

1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by zezinho
0

.SeriesCollection(x).Name = Plan1.Cells(D, 18).Value
.SeriesCollection(x).Values = Plan1.Cells(D, 19).Value
.SeriesCollection(x).XValues = Plan1.Cells(D, 20).Value

that's the part that contain the error.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.