Stopwatch that starts when a checkbox is ticked and resets when checkbox is unticked

IAAMOATGTIL

New Member
Joined
Jan 14, 2017
Messages
5
Can you put a stopwatch in Excel that starts when a checkbox is ticked and resets when the checkbox is unticked? And finally, stops when another checkbox is ticked?
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
I'm trying to create a simple time-sheet that records the time an employee starts work at the office. The employee would tick on a "start" checkbox in Excel when he/she starts his/her work.

A stopwatch should start as soon as the "start" checkbox is ticked. And the stopwatch should reset when the "start" checkbox is unticked.


Finally, the stopwatch should stop when another checkbox (named "end") is ticked.


Many thanks for any help.
 
Upvote 0
The simple answer is yes.

Here is a project for you to view and experiment with. You'll need to change the CommandButtons to Checkboxes to fire the macros.

Download : https://www.amazon.com/clouddrive/s...eRt8eu42inGBz33mSi?ref_=cd_ph_share_link_copy

Code:
Option Explicit

Dim CountDown As Date
Sub Timer()
    CountDown = Now + TimeValue("00:00:01")
    Application.OnTime CountDown, "Reset"
End Sub
Sub Reset()
Dim count As Range
    Set count = [A1] ' A1 contains the number of seconds for the countdown.
        count.Value = count.Value - 1
    If count <= 0 Then
        MsgBox "Countdown complete."
        Exit Sub
    End If
        Call Timer
End Sub
Sub DisableTimer()
On Error Resume Next
Application.OnTime EarliestTime:=CountDown, Procedure:="Reset", Schedule:=False
End Sub


Sub clrAll()
    Sheets("Sheet1").Range("A1").Value = ""
End Sub
 
Upvote 0
Hi Logit. Thank you for the quick response. I appreciate you posting the link. I'll try to experiment with it and i will let you know of my progress.


By the way, i'm a begginer in Excel and I am not VBA literate. But I'll see what i can do.


Thanks again for your help.
 
Upvote 0
The simple answer is yes.

Here is a project for you to view and experiment with. You'll need to change the CommandButtons to Checkboxes to fire the macros.

Download : https://www.amazon.com/clouddrive/s...eRt8eu42inGBz33mSi?ref_=cd_ph_share_link_copy

Code:
Option Explicit

Dim CountDown As Date
Sub Timer()
    CountDown = Now + TimeValue("00:00:01")
    Application.OnTime CountDown, "Reset"
End Sub
Sub Reset()
Dim count As Range
    Set count = [A1] ' A1 contains the number of seconds for the countdown.
        count.Value = count.Value - 1
    If count <= 0 Then
        MsgBox "Countdown complete."
        Exit Sub
    End If
        Call Timer
End Sub
Sub DisableTimer()
On Error Resume Next
Application.OnTime EarliestTime:=CountDown, Procedure:="Reset", Schedule:=False
End Sub


Sub clrAll()
    Sheets("Sheet1").Range("A1").Value = ""
End Sub


Hi Logit,

Pardon my ignorance, but how do you convert the countdown figures so that it displays as a timer? Currently, it just keeps counting even if it's over 60 seconds. The countdown shows: 61, 62, 63 and so on..

I would appreciate it if you could guide me how to convert the countdown figures to time so that when it is 61, it should show 1:01.

Thanks again for your help.
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,120
Members
451,399
Latest member
alchavar

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