Hey,

Plz, I need some help with this code, In another workbook it worked. Specific on this one it's not working.
The error is occuring on the red line, right after it's added a new serie on the graph.

Sub Graph()

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

x = 0
y = 3

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

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

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

End With

With ActiveChart

Worksheets("Plan1").Select
a = Worksheets("Plan1").Range("U4")

Do Until a = y

y = y + 1
D = y
x = y - 3
a = a + 3

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

Loop

End With

End Sub

it is Plan1 or Plna1

It was just a type mistake when I was coping in here, on my sheet is correct....
It's not this problem...

But tks anyway

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.