Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stopwatch query
I'm trying to program a macro stopwatch for purpose of displaying it on
a TV scoreboard/"FoxBox", yet the information I've found online hasn't proven precise. I'd like for this stopwatch to count down by tenths of a second, in addition to count up as much as 100ths of a second (for track races). Also, it needs to be able to restart where it left off instead of reseting or continuing as though I hadn't stopped it. I'm probably asking for too much, but every little bit helps. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stopwatch query
Thought I'd update this:
I have the basics down (Starting and Stopping) and can now pause/unpause without resetting. However, I'm still unsure as to how to get my clock to tick down by tenths and jiffies (100ths). atlashill wrote: I'm trying to program a macro stopwatch for purpose of displaying it on a TV scoreboard/"FoxBox", yet the information I've found online hasn't proven precise. I'd like for this stopwatch to count down by tenths of a second, in addition to count up as much as 100ths of a second (for track races). Also, it needs to be able to restart where it left off instead of reseting or continuing as though I hadn't stopped it. I'm probably asking for too much, but every little bit helps. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stopwatch query
Here is a previous post of mine. It is 1 sec precision, but can be adjusted
http://tinyurl.com/8fcc5 It does have a restart option, but it would be a sim-ple proce Sub RestartClock() fncWindowsTimer 1000, WindowsTimer '1 sec End Sub -- HTH Bob Phillips "atlashill" wrote in message oups.com... Thought I'd update this: I have the basics down (Starting and Stopping) and can now pause/unpause without resetting. However, I'm still unsure as to how to get my clock to tick down by tenths and jiffies (100ths). atlashill wrote: I'm trying to program a macro stopwatch for purpose of displaying it on a TV scoreboard/"FoxBox", yet the information I've found online hasn't proven precise. I'd like for this stopwatch to count down by tenths of a second, in addition to count up as much as 100ths of a second (for track races). Also, it needs to be able to restart where it left off instead of reseting or continuing as though I hadn't stopped it. I'm probably asking for too much, but every little bit helps. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stopwatch query
Are there any changes I need to make to adapt it to VB6.3 and/or Excel
for XP? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stopwatch query
Right now I'm using Boolean operands to switch on/off my stopwatch.
Are there any changes I'll need to make to account for this, in addition to this being in Excel for XP or VB 6.3? |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stopwatch query
How do you mean?
And it works for Excel XP. -- HTH Bob Phillips "atlashill" wrote in message oups.com... Right now I'm using Boolean operands to switch on/off my stopwatch. Are there any changes I'll need to make to account for this, in addition to this being in Excel for XP or VB 6.3? |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stopwatch query
The code you supplied failed to stop counting when hitting zero, giving
me way too many prompt boxes to clear out. Below are the stopwatch modules I've found online and augmented to fit. As I said earlier, this below is capable of starting, stopping, and restarting where it left off. I'd like to find a way to adapt your code to fit this. ========== First Module: Declare Function timeGetTime Lib "winmm.dll" () As Long Dim stopit As Boolean Dim XCClock As Boolean Dim StartTime Sub RunTimer() stopit = False clock End Sub Sub clock() If stopit = True Then Exit Sub ActiveWorkbook.Worksheets(1).Range("C7").Value = _ Format(Now, "hh:mm:ss") Application.OnTime (Now + TimeSerial(0, 0, 1)), "clock" End Sub Sub PauseTime() stopit = True End Sub Sub StopClock() XCClock = False End Sub Sub RestartClock() XCClock = True StartTime = TimeValue(Now()) ControlClock End Sub Sub ControlClock() If XCClock = True Then Range("C5").Value = Now - StartTime Application.OnTime Now + TimeValue("00:00:01"), "ControlClock" End If End Sub Second Module: Dim AlarmTime As Date, AlarmTime2 As Date Sub CountDown60() ActiveSheet.Range("K1").Value = "60" ActiveSheet.Range("K2").Value = "Counting" Call TrapTime60 Call TrapTime End Sub Sub CountDown30() ActiveSheet.Range("K1").Value = "30" ActiveSheet.Range("K2").Value = "Counting" Call TrapTime30 Call TrapTime End Sub Sub CountDownAgain() ActiveSheet.Range("K1").Value = Range("K1").Value ActiveSheet.Range("K2").Value = "Counting" Call TrapTime Call TrapTimeRestart End Sub Private Sub ShowTimeLeft() ActiveSheet.Range("K1").Value = Second(AlarmTime - Now) Call TrapTime End Sub Private Sub TrapTime60() AlarmTime = CDate(Date) + TimeValue(Now()) + TimeValue("00:01:00") Application.OnTime earliesttime:=AlarmTime, procedu="StopTimer" End Sub Private Sub TrapTime30() AlarmTime = CDate(Date) + TimeValue(Now()) + TimeValue("00:00:30") Application.OnTime earliesttime:=AlarmTime, procedu="StopTimer" End Sub Private Sub TrapTimeRestart() AlarmTime = CDate(Date) + TimeValue(Now()) + Range("K3").Value Application.OnTime earliesttime:=AlarmTime, procedu="StopTimer" End Sub Private Sub TrapTime() AlarmTime2 = CDate(Date) + TimeValue(Now()) + TimeValue("00:00:01") Application.OnTime earliesttime:=AlarmTime2, procedu="ShowTimeLeft" End Sub Sub StopTimer() On Error Resume Next Application.OnTime earliesttime:=AlarmTime2, procedu="showtimeleft", schedule:=False On Error GoTo 0 ActiveSheet.Range("K2").Value = "Done" End Sub |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stopwatch query
How do I adjust precision? Am I suppose to change the number in the
command "fncWindowsTimer 1000"? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
stopwatch times | Excel Discussion (Misc queries) | |||
Stopwatch | Excel Discussion (Misc queries) | |||
StopWatch Macros | Excel Worksheet Functions | |||
Stopwatch | Excel Worksheet Functions | |||
Stopwatch/Clock | Excel Programming |