1. Engineering
  2. Computer Science
  3. im trying to create a macro that animates a chart...

Question: im trying to create a macro that animates a chart...

Question details

I'm trying to create a Macro that animates a chart to flick through each set of data, I keep getting errors on selecting the chart series (line 5)

Sub Chart1()

Application.ScreenUpdating = False


Worksheets("TR01db.vel").ChartObjects("Chart 1").SeriesCollection(1).XValues = Worksheets("TR01db.vel").Range(Cells(4, 1), Cells(1000, 1))
Worksheets("TR01db.vel").ChartObjects("Chart 1").SeriesCollection(1).Values = Worksheets("TR01db.vel").Range(Cells(4, 2), Cells(1000, 2))
Application.ScreenUpdating = True

For k = 0 To 100
Worksheets("TR01db.vel").ChartObjects(1).SeriesCollection(1).XValues = Worksheets("TR01db.vel").Range(Cells(4, 1), Cells(1000, 1))
Worksheets("TR01db.vel").ChartObjects(1).SeriesCollection(1).Values = Worksheets("TR01db.vel").Range(Cells(4, 2 + k), Cells(1000, 2 + k))

Next k

Set rValues = Nothing
Set rCell = Nothing

Exit Sub
MsgBox Err.Description & " Procedure Chart1"
Resume BeforeExit
End Sub

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution