Problem with WAIT

M

Mike

Hi,
I’m having a problem displaying seconds as they count down
from a value.

Help indicates the following code for the WAIT method:

This example displays a message indicating whether 10
seconds have passed.
If Application.Wait(Now + TimeValue("0:00:10")) Then
MsgBox "Time expired"
End If

When I put the example in my code as a stand-alone, it
works as advertised. So, based on above, I’ve written the
following code:

For i = 10 To 1 Step -1
If Application.Wait(Now + TimeValue("0:00:01")) Then
Range(A1).Offset(2, 0).Value = i
Next i

The problem is that I get an error saying ‘For’ without
a ‘Next’. If I comment out the “If Application...” line,
the Next is found and it runs! (Of course I get a “1” in
the cell, but that is expected.)

What I really want to do is, based on a count value in a
cell (1-99) display a count-down in another cell. The
count should increment in seconds. I don’t care if the
application is stopped for 1-second intervals or not. The
key here is showing the counting down.

I’m using Excel 2000 if it makes a difference.

Any ideas? Thanks in advance.
Mike
 

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

Top