Thanks for your help half ace,
The following are the codes I’m trying to use
Code 1
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, procedure:=cRunWhat, schedule:=True
End Sub
Sub The_Sub()
'get the current timer value
timer_value = Range("timer").Value
'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, procedure:=cRunWhat, schedule:=False
Range("timer").Value = Range("duration").Value
End Sub
Sub PauseTimer()
On Error Resume Next
Application.OnTime earliesttime:=RunWhen, procedure:=cRunWhat, schedule:=False
End Sub
Sub ResumeTimer()
RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
Application.OnTime earliesttime:=RunWhen, procedure:=cRunWhat, schedule:=True
End Sub
Code 2
Dim NextTime As Date
Sub Flash()
NextTime = Now + TimeValue("00:00:01")
With ActiveWorkbook.Styles("Flash").Font
If .ColorIndex = 2 Then .ColorIndex = 3 Else .ColorIndex = 2
End With
Application.OnTime NextTime, "Flash"
End Sub
Sub StopIt()
Application.OnTime NextTime, "Flash", schedule:=False
ActiveWorkbook.Styles("Flash").Font.ColorIndex = xlAutomatic
End Sub
I would like to get the FLASH macro to work on the START command, and the STOPIT to work on the resume command, is this possible ?
i have both of the working on seperate work books and would like to combine them.dadad.