PDA

View Full Version : Solved: Excel Code running too fast



countryfan_n
01-03-2009, 06:11 AM
Hello friends,

I have built this car race temp. /game and the codes run smoothly, but require some tweaking:
Problem is : While the code "A" is running, the range I22:R22 should show the movement of the cars (conditional format). The codes are fine, but the artificial visual effect is not happening because the code is running too fast. Is there any way around that? To show the effect of cars racing/skipping cells.

I hope I was able to explain what I need to achieve. If anything seems vague let me know, I would be glad to explain more.

Thanks a lot in advance!
Nawaf

Oorang
01-03-2009, 07:13 AM
Hi Nawaf,
At lot of can't/won't open attachments to see the code, so it might be good to post the pertinent bits. However, just as an offhand remark, have you taken a look at the Excel.Application.Wait method?

GTO
01-03-2009, 12:32 PM
Greetings Nawaf,


...but the artificial visual effect is not happening because the code is running too fast. Is there any way around that? To show the effect of cars racing/skipping cells...

Reference problem number one only: I'm at home and on my "poor ol' laptop", so maybe I'm missing the boat as to the 'running too fast', but I don't think that is the initial problem. I don't see anywhere where the (wow, my language skills are suffering a bit...) cars are 'updating'.

I understand why you shut screen updating off at the start, due to all the Selecting that your code is currently doing, but at some point, you need to momentarily turn it back on to show the cars advance.

For a simple "first step" only, try this > in Sub F(), right below:

Application.CutCopyMode = False

Insert:

Application.ScreenUpdating = True
DoEvents
Application.ScreenUpdating = False

Now depending upon the speed of your PC, you may well then need to consider Aaron's suggestion as to Application.Wait to then slow things down a bit, but I'm fairly sure that the current issue is as stated, nothing is updating visually until the race is already over. Hope that made sense?

Mark

countryfan_n
01-04-2009, 02:16 AM
Thank you so much for helping me with my post, Truly appreciate it.