Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Stopwatch query

Are there any changes I need to make to adapt it to VB6.3 and/or Excel
for XP?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
stopwatch times Craig Excel Discussion (Misc queries) 9 August 18th 11 07:14 PM
Stopwatch Bob Excel Discussion (Misc queries) 5 February 3rd 09 01:32 AM
StopWatch Macros ExcelMS Excel Worksheet Functions 2 June 1st 08 05:16 PM
Stopwatch Metolius Dad Excel Worksheet Functions 1 April 11th 05 03:14 PM
Stopwatch/Clock Easty Excel Programming 6 May 16th 04 10:19 AM


All times are GMT +1. The time now is 11:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"