I currently have a timer routine that counts down from 30 minutes. I display the current time remaining in the countdown, as it counts down.
What I would like to do is have it change the color of the backround for that cell when the timer hits 30 seconds left, then 15, then 5, then every second after that until it hits zero.
Here is the code I'm using (courtesy of VoG and a few alterations)
Here is the image of the timer:
http://img98.imageshack.us/i/timerscreenshot.gif/
As always, thanks for any and all help.
Ralph
What I would like to do is have it change the color of the backround for that cell when the timer hits 30 seconds left, then 15, then 5, then every second after that until it hits zero.
Here is the code I'm using (courtesy of VoG and a few alterations)
Code:
Dim NextTick As Date
Sub StartTimer()
With ThisWorkbook.Sheets("Data").Range("D2")
.NumberFormat = "hh:mm:ss"
.Value = Time
End With
Call FormatTime
Call TickTock
End Sub
Private Sub FormatTime()
With ThisWorkbook.Sheets("Sheet1").Range("D4")
.NumberFormat = "mm:ss"
.Value = ThisWorkbook.Sheets("Data").Range("E3")
End With
End Sub
Private Sub TickTock()
With ThisWorkbook.Sheets("Sheet1").Range("D4")
.NumberFormat = "mm:ss"
.Value = ThisWorkbook.Sheets("Sheet1").Range("D4")
.Value = .Value - (1 / 86400)
If .Value <= (1 / 86400) Then
Beep
Call StopClock
With ThisWorkbook.Sheets("Data").Range("H2")
.NumberFormat = "hh:mm:ss"
.Value = Time
End With
Call StartTimer
End If
End With
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "TickTock"
End Sub
Sub StopClock()
On Error Resume Next
Application.OnTime earliesttime:=NextTick, procedure:="TickTock", schedule:=False
On Error GoTo 0
End Sub
Here is the image of the timer:
http://img98.imageshack.us/i/timerscreenshot.gif/
As always, thanks for any and all help.
Ralph