Link to home
Start Free TrialLog in
Avatar of fjkilken
fjkilken

asked on

Code to create race timer in Excel

HI
I want to add a button into an Excel sheet to perform basic timing for multiple competitors in a race.

Basically, all the button needs to do is enter the current time (ideally down to 10ths or 100ths of a second) in a cell, and then move down to the next cell below, and enter the next time in that cell when the button (or Enter key) is pressed again

Thanks a lot!

Fergal
Avatar of zorvek (Kevin Jones)
zorvek (Kevin Jones)
Flag of United States of America image

I used this macro:

Option Explicit

Private StartTime As Double

Public Sub InsertTime()

    If StartTime = 0 Then
        StartTime = Timer
    Else
        ActiveCell = (Timer - StartTime) / 24 / 60 / 60
        ActiveCell.Offset(1, 0).Select
    End If

End Sub

See the attached workbook.

The first click of the button starts the timer. Each subsequent click records the time at the click in the active cell and moves the selection down one cell.

Kevin
Q-26990141.xls
ASKER CERTIFIED SOLUTION
Avatar of zorvek (Kevin Jones)
zorvek (Kevin Jones)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dmitry_n
dmitry_n

Try this excel logging stopwatch http://www.xnotestopwatch.com
Avatar of fjkilken

ASKER

thanks!