Countdown Timer

uniden32

New Member
Joined
Sep 19, 2010
Messages
22
Hey mates,

I've searched the forums for existing countdown timers, but haven't found any that suited my needs.

I'm looking for a timer that counts down the minutes and seconds based on the current time.

The user would open the spreadsheet, there would be a button they could press that would display a timer based on how many minutes were left in the current half-hour.

(ie; If it were currently 9:15.20, the timer would start at 15.20 and count down. If the time was 9:36.18, the timer would start at 23.42 and count down.)

Once the timer hit 0, it would make a sound, then it would immediately restart at 30.00, and the cycle would continue as long as the the spreadsheet was open.

Thanks in advance,

Ralph
 
Ok, sorry for the extra post, couldn't figure out how to delete my last post.

Ok, so I've got it running, I have several issues:

1. When it's running for 30 minutes, the timer can lose up to 2 minutes.
2. I need a way to loop it once the timer hits 0, so that it restarts.

Here is my current code:

Code:
Dim NextTick As Date

Sub StartTimer()
With ThisWorkbook.Sheets("Data").Range("D2")
    .NumberFormat = "hh:mm:ss"
    .Value = Time
End With
Call TickTock1
Call TickTock
Beep
End Sub
Private Sub TickTock1()
With ThisWorkbook.Sheets("Sheet1").Range("B2")
    .NumberFormat = "mm:ss"
    .Value = ThisWorkbook.Sheets("Data").Range("E3")
End With
End Sub

Private Sub TickTock()
With ThisWorkbook.Sheets("Sheet1").Range("B2")
    .NumberFormat = "mm:ss"
    .Value = ThisWorkbook.Sheets("Sheet1").Range("B2")
    .Value = .Value - (1 / 86400)
    If .Value <= (1 / 86400) Then
        .Value = Time
    End If
End With
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "TickTock"

End Sub

Sub StopClock()
On Error Resume Next
Application.OnTime earliesttime:=NextTick, procedure:="TickTock", schedule:=False
On Error GoTo 0
End Sub

As always, thanks in advance,

Ralph
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,224,506
Messages
6,179,159
Members
452,892
Latest member
yadavagiri

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