Consulting

Results 1 to 2 of 2

Thread: animated chart

  1. #1
    VBAX Tutor
    Joined
    Sep 2008
    Posts
    213
    Location

    animated chart

    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

    [VBA]
    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


    [/VBA]

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    I don't know. Try this[VBA]ActiveChart.SeriesCollection(1).Name = "=CurveDataZero!$A$" & counter
    ActiveChart.Update

    Application.Wait Now + TimeValue("00:00:0" & STOP_SEC)[/VBA]
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •