Refreshing Charts inside a Macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a macro that simulates time for an equation. I then have the results
of this equation feeding a chart which provides a simple animation of what is
occuring. However the chart does not upate until the macro has finished it's
steps. Anyhelp???
 
You may need to show us the code but a couple of guesses in the
meantime. Make sure application.screenupdating = true and try inserting
the DoEvents statement after you update the chart.

Hope this helps
Rowan
 
For now the spreadsheet is pretty simple as I am just trying to see if this
works.

Cell A1 represents time, this is driven by the computers clock via the now()
function in Excel
Cell b1 represents postion and the formula is "=sin(A1)"
I then have a chart that is plotting B1.

If I hold the delete key down, that forces the worksheet to continually
refresh and the chart updates...

I created a simple counter in the macro that manipulates another cell to
force the worksheet to refresh each iteration. While this is occuring, I
can see the cells changing but the chart does not refresh until the end.

Here is the code in the sheet...

**************************************
Cells(7, 1).Value = 0
Do Until Cells(7, 1).Value = 10000
Cells(7, 1).Value = Cells(7, 1).Value + 1
Loop

'
End Sub

****************************************
 
From looking at some other postings I finally found something that is
working...

I've changed the code to this...
*************************************
Cells(7, 1).Value = 0
Do Until Cells(7, 1).Value = 1000
Cells(7, 1).Value = Cells(7, 1).Value + 1

Application.Wait Now + TimeSerial(0, 0, 0.1)

Loop
***************************************
This doesn't seem too elegant but it's working. But if somebody has better
solution I'd be glad to use it.
Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top