Visable Stopwatch for Road Race

Conroy

New Member
Joined
Sep 9, 2004
Messages
6
I have several working stopwatches but nothing I can see running. Here is what I want:

* Buttons to start, stop and reset stopwatch
* Spacebar to mark time as runners finish
* Each time distributed to the next cell beside runners name (to tenth of second) Example: Names listed in A1, A2, A3 . . . respective time recorded in B1, B2, B3 . . .

* Ability to see the running clock during the race

I know the first three are possible. What about the visiable running clock?

Thanks,
Conroy :rolleyes:
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Here's a little scrap of code I've been playing with...

Code:
Dim SchedRecalc As Date
Sub Startclock()
Range("v6").Value = Format(Time, "hh:mm:ss AM/PM")

Call Recalc
End Sub

Sub Recalc()

Range("v1").Value = Format(Now, "dd-mmm-yy")
Range("w6").Value = Format(Time, "hh:mm:ss AM/PM")

Call SetTime
End Sub

Sub SetTime()
SchedRecalc = Now + TimeValue("00:00:01")
Application.OnTime SchedRecalc, "Recalc"
End Sub

Sub Disable()
On Error Resume Next
 Application.OnTime EarliestTime:=SchedRecalc, Procedure:="Recalc", Schedule:=False
End Sub

It may not be perfect but it DOES display a running time. :biggrin:
 
Upvote 0
Welcome to the Board!

Here's a shareware Stopwatch Add-In that may be useful.

I recall someone putting together several working stopwatches that I'll try to find.

Smitty
 
Upvote 0
R.K.

I could kiss you . . . figuratively, of course. What a beautiful site - watching that clock run!

Do you (or anyone) know how to add to the code to have the spacebar distribute the times to successive cells?

Incredible! Thanks.

Conroy
 
Upvote 0
:oops: I'll pass on the (figurative) kiss thanks.
Glad I could help though. Unfortunately I'm not that far advanced that I'm going to be able to help you with the spacebar distribution. I'll have to leave that up to the real VBA wizards here.
 
Upvote 0
This code uses three Form Toolbar buttons: Start [stopwatch], Stop [myQuit] & ReSet [myReSet].
Each is assigned its macro.
The code will show the time in the sheet cell, starting from zero the first time opened and run. If stoped [Stop] and re-run [Start] it continues from the last time shown. If ReSet the time goes to zero and when then re-run it starts from zero.

Not included: You can add code to capture the stop time and using "xlUp" code record your splits each time you stop and keep track of the total lapsed time. Currently it stops tracking time each time it is stoped.


Public StopSW As Boolean
Public ReSetSW As Boolean
Public myTime

Sub stopwatch()
'Seconds and fractions of seconds Timer!
Dim Start, Finish, TotalTime

'Set timer.
Start = Timer
StopSW = False
ReSetSW = False
myTime = Sheets("Sheet1").Range("AA1").Value
Sheets("Sheet1").Range("A1").Select

myStart:
'Yield to other processes.
DoEvents
'Calculate time.
Finish = Timer
TotalTime = Finish - Start
'Show time on sheet!
Sheets("Sheet1").Range("A1").Value = Format(myTime + TotalTime, "0.0000") & " Seconds"
'Test for "ReSet or Stop!"
If ReSetSW = True Then
Sheets("Sheet1").Range("A1").Value = 0
Sheets("Sheet1").Range("AA1").Value = 0
StopSW = True
End If
If Not StopSW = True Then
Sheets("Sheet1").Range("AA1").Value = TotalTime
GoTo myStart
End If
End
End Sub

Sub myQuit()
StopSW = True
End Sub

Sub myReSet()
Sheets("Sheet1").Range("A1").Value = 0
Sheets("Sheet1").Range("AA1").Value = 0
ReSetSW = True
End Sub
 
Upvote 0
Joe,

This is outstanding! Forgive my inability to run with your code but can I trouble you to explain a few things:

* How do I format the stopwatch to show MM:SS.0? Simply reformating the cell does nothing.

* How do I use the space bar to "capture" each individual time and distribute them to successive cells?

I just joined the board and I am truely humbled. Thanks for your help.

Conroy
 
Upvote 0
To get mm:ss.0 you will need to add an IF test for values over 60 and then divide the value by 60 and do a new FORMAT statement. The result does not directly format as time, the timer function in this case is purely an an indicater of seconds and portions of a second only.

As to doing splits the flow of the code will need to be changed to keep timming if the "Split" button is pressed [to be added button]. The actual placement of the value of the split is easy: load a variable with the split from that cycle of the loop and then transfer it's value to the sheet with an xlUp code to add the latest split below the last one.

I was thinking of playing with this, but do not have time today?
 
Upvote 0
Add a "Split" button and use the code below to print the split time to a list.
Start - Split... - Stop - ReSet: Do split and continuious times.
Start - (Stop - Start )... - Stop: Start and stop discontinuious time.
Start - Stop: Single time.
Reset: Erase list and re-set to zero.

Public StopSW As Boolean
Public ReSetSW As Boolean
Public SplitSW As Boolean
Public myTime

Sub stopwatch()
'Seconds and fractions of seconds Timer!
Dim Start, Finish, TotalTime

'Set timer.
Start = Timer
StopSW = False
ReSetSW = False
myTime = Sheets("Sheet1").Range("AA1").Value
Sheets("Sheet1").Range("A1").Select

myStart:
'Yield to other processes.
DoEvents
'Calculate time.
Finish = Timer
TotalTime = Finish - Start
'Show time on sheet!
Sheets("Sheet1").Range("A1").Value = Format(myTime + TotalTime, "0.0000") & " Seconds"
'Test for "ReSet or Stop!"
If ReSetSW = True Then
Sheets("Sheet1").Range("A1").Value = 0
Sheets("Sheet1").Range("AA1").Value = 0
StopSW = True
End If
If Not StopSW = True And SplitSW = False Then
Sheets("Sheet1").Range("AA1").Value = TotalTime
GoTo myStart
End If
If SplitSW = True Then
Sheets("Sheet1").Range("A65536").End(xlUp).Offset(1, 0).Value = Format(TotalTime, "0.0000")
Sheets("Sheet1").Range("AA1").Value = TotalTime
SplitSW = False
GoTo myStart
End If
End
End Sub

Sub myQuit()
StopSW = True
End Sub

Sub myReSet()
Sheets("Sheet1").Range("A1").Value = 0
Sheets("Sheet1").Range("AA1").Value = 0
Range("A2:A65536").Select
Selection.ClearContents
Range("A1").Select
ReSetSW = True
End Sub

Sub mySplit()
SplitSW = True
End Sub
 
Upvote 0
:biggrin: I am truly humbled. The program I wrote simply indexes runners by number and places them sequentially on the sheet. Your code will really put this application over the top. Thank you so much for your time.
Conroy
 
Upvote 0

Forum statistics

Threads
1,215,890
Messages
6,127,594
Members
449,386
Latest member
owais87

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top