Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Chart Animation VBA

  Asked By: Adelisa    Date: Sep 01    Category: MS Office    Views: 1739
  

I am trying to animate a bar graph. The graph is for monthly
sales. I would like the bar graph to grow up to the current level
of sales upon the push of a command button.

I have successfully written the code that starts the sales at zero
dollars and grows it up to the current level with the push of a
command button. I also have a bar graph that is linked to the cell
with the growing dollars. However, the graph does not grow as the
numbers change. It only draws the graph when the numbers have
finished changing.

My first thought was that the numbers are changing too fast for the
chart to react and maybe all I needed to do was slow it down with
the 'wait' command. I included a line for 'wait' in the code and it
works, but too slowly. That is because Excel won't allow you to
break time down further than 1 second. It would work perfectly if I
could use the 'wait' command with fractional seconds.

I first tried this by using a spinner button instead of the code to
get the sales dollars to increase and it worked perfectly. The graph
grew with the growing dollars. But trying to animate it with VBA is
escaping me.

Does anyone have any ideas?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Jacob Evans     Answered On: Sep 01

You'll probably need to put in a loop to (a) pause for a few
milliseconds and (b) refresh the graph  or screen repeatedly.

 
Answer #2    Answered By: Chaths Massri     Answered On: Sep 01

I now have one animated chart.

Before the 'next' command  in my code  I inserted:

Sleep 50
Range("C6").Select

It did the trick.

 
Didn't find what you were looking for? Find more on Chart Animation VBA Or get search suggestion and latest updates.




Tagged: