Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
below is the programming that i have created. When i enter "10" in cell A2 I
receive an error. Please assist me. Public RunWhen As Double Public timer_value As Integer Public Const cRunIntervalSeconds = 1 ' 1 Second Public Const cRunWhat = "The_Sub" Sub StartTimer() RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds) Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat, schedule:=True End Sub Sub The_Sub() 'get the current timer value 'timer_value = Range("timer").Value timer_value = ActiveCell.FormulaR2C1 'now increase "level now" if the timer has got down to Zero If timer_value = 0 Then Range("level_now").Value = Range("level_now").Value + 1 'now reduce the timer by 1, or reset to the duration if it's on Zero If timer_value = 0 Then Range("timer").Value = Range("duration").Value Else Range("timer").Value = timer_value - 1 'now beep in last ten seconds, first getting the new timer value timer_value = Range("timer").Value If timer_value 0 And timer_value < 11 Then Beep StartTimer End Sub Sub StopTimer() On Error Resume Next Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat, schedule:=False Range("timer").Value = Range("duration").Value End Sub Sub PauseTimer() On Error Resume Next Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat, schedule:=False End Sub Sub ResumeTimer() RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds) Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat, schedule:=True End Sub -- Rick |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to set up countdown timer to countdown days to a specific day | Excel Worksheet Functions | |||
Need a countdown timer | Excel Programming | |||
Countdown Timer | Excel Programming | |||
Countdown timer | Excel Programming | |||
Is a countdown timer possible? | Excel Discussion (Misc queries) |