PDA

View Full Version : animated chart



maninjapan
07-09-2013, 12:47 PM
I am trying to use the following macro to run through data points and create an animated chart. If I run the code directly from the editor, it runs fine and I can see the chart go through the data points in real time.

However, I when I try to run it through a form control button on the actual sheet, I can see the formula scrolling through the data points, but the chart doesn't update...

Does anyone have any idea as to what is going on here?


Thanks


Sub CycleChart2()
'
Dim STOP_SEC As Integer
Dim START_ROW As Integer
Dim STOP_ROW As Integer
Dim counter As Integer


With ActiveWorkbook.Sheets("CurveDataZero")

STOP_SEC = .Range("A2")
START_ROW = .Range("B1")
STOP_ROW = .Range("B2")
Sheets("Chart").Activate
ActiveSheet.ChartObjects("グラフ 3").Activate

For counter = STOP_ROW To START_ROW Step -1
ActiveChart.SeriesCollection(1).Select
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(1).Values = _
"=CurveDataZero!$E$" & counter & ",CurveDataZero!$G$" & counter & ",CurveDataZero!$I$" & counter & ",CurveDataZero!$K$" & counter & ",CurveDataZero!$M$" & counter & ",CurveDataZero!$O$" & counter & ",CurveDataZero!$Q$" & counter & ",CurveDataZero!$S$" & counter & ",CurveDataZero!$U$" & counter & ",CurveDataZero!$W$" & counter & ",CurveDataZero!$Y$" & counter & ",CurveDataZero!$AA$" & counter & ""
ActiveChart.SeriesCollection(1).Name = "=CurveDataZero!$A$" & counter


Application.Wait Now + TimeValue("00:00:0" & STOP_SEC)

Next counter


End With


End Sub

SamT
07-11-2013, 07:53 AM
:dunno I don't know. Try thisActiveChart.SeriesCollection(1).Name = "=CurveDataZero!$A$" & counter
ActiveChart.Update

Application.Wait Now + TimeValue("00:00:0" & STOP_SEC)