60 Second Countdown NOT using the WAIT function...
VBA doesn't run when you're in cell edit mode.
Tim
"Davey" wrote in message
...
Hi, all,
This timer totaly stops counting when I start typing on a cell.
Is there a way to keep it running, at least on the background?
Thanks,
Davey
"Bob Phillips" wrote:
Use Ontime
Sub Countdown()
Static nCount As Long
Const CountTime As Long = 6 '0
If nCount = 0 Then
nCount = CountTime
Else
nCount = nCount - 1
End If
If nCount 0 Then
Range("A1").Value = nCount
nTime = Now() + TimeSerial(0, 0, 1)
Debug.Print nTime
Application.OnTime nTime, "Countdown"
End If
End Sub
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"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
|