60 Second Countdown NOT using the WAIT function...
You can set the OnTime function to occur at some future point e.g. 1 secs.
This could trigger your cell count down, and then restart the ontime
event.again until the cell value reaches zero.
Whilst the ontime events are running you can interact with your workbook, so
a user action could cancel the ontime event, carry out the user actions and
then restart the ontime events.
This procedure gives you the countdown, the rest depends on what the user
interaction will be
Sub timerA1()
Application.OnTime Now + TimeValue("00:00:01"), "xTick"
End Sub
Sub xTick()
With Sheets("Sheet1")
.Range("A1") = .Range("A1") - 1
If .Range("A1") 0 Then timerA1
End With
End Sub
--
Cheers
Nigel
"Trevor Williams" wrote in
message ...
Hi Nigel,
I don't think the OnTime funtion will work as it waits for a pre-defined
time before it runs a procedure, and since I don't know when the user
wants
to stop the countdown, I can't set it.
Is that right, or am I missing something?
Any other ideas?
Thanks
"Nigel" wrote:
Maybe you could use the Application.OnTime function ??
--
Cheers
Nigel
"Trevor Williams" wrote in
message ...
Hi all
I am creating a 60 second countdown in XL2002 which currently uses the
system time and the wait function: Application.Wait (Now +
TimeValue("0:00:01")). After each second a cell value decreases (60
down
to
0) and another cells Interior.Colorindex is changed.
This works well, but I need to be able to interupt the countdown to add
data, and then resume the countdown - something that can't be done
using
the
wait function.
I would like to interupt the countdown by pressing a button, which in
turn
pops up a userform to add data to a table - (again, something that
works
but
not whilst the countdown is working!)
Is there another way of approaching this?
Thanks in advance!
Trevor
|