Countdown Timer

R

Robert_NSBG

I created a spreadsheet to score my daughter's basketball games. I need to
create a"Game Clock" macro that I can set the amount of time at the start of
each period(minutes, seconds, tenths of seconds if possible) and have it
count down until the time has expired. I also need to stop and start the
timer with a button.

Can anyone help???
 
M

Mike H

Hi,

I'm not sure about 10th seconds but here's one for H:M:S

Format A1 as HH:MM:SS and enter a duration as a time. make it nice and big.
I merged a bunch of cells and set the font to 48 point.

Alt+f11 to open VB editor and right click 'This Workbook' and insert module
and paste the code below in

Put a button on your sheet to run the TIMER sub and the clock counts down.
At any time enter a t in d1 and the clock pauses. delete the T and the clock
resumes. the sheet with the clock must remain the active sheet

Sub Timer()
CountDown = Now + TimeValue("00:00:01")
Application.OnTime CountDown, "GoClock"
End Sub
Sub GoClock()
Dim count As Range
Set count = [A1] ' Enter time in seconds
If UCase(Range("D1")) = "T" Then
count.Value = count.Value
Else
count.Value = count.Value - TimeValue("00:00:01")
End If
If count <= 0 Then
MsgBox "Game Over"
Exit Sub
End If
Call Timer
End Sub


Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

HELP for COUNTDOWN TIMER 3
Countdown timer for powerpoint 1
Countdown Timer - not stopwatch 9
Countdown 1
Countdown timer 1
count down 3
How to create a countdown timer in a worksheet 2
Adjust my countodwn 4

Top