Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in


How to create stopwatch in Excel worksheet?

If there is a stopwatch in your worksheet, you will know the time to finish a job. How can you create a stopwatch in a sheet with a Start, Stop, and Reset Button as following screenshot shown? If you click the Start button, it will start time, if you click Stop button, it will stop time, and the Reset button can help you to reset time. This article, I will talk about how to create a simple and handy stopwatch in Excel.

doc create stopwatch 1

Create a stopwatch with three buttons by using VBA code

Add a number of hours / minutes / seconds to datetime:

With Kutools for Excel's Add Hours / Minutes / Seconds to date features, you can quickly add or subtract a number of hours, minutes or seconds to a dateime. Click to download and free trial Kutools for Excel now!

doc create stopwatch 10

Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!

Create a stopwatch with three buttons by using VBA code

To create a stopwatch with three buttons, Start, Stop and Reset, please do with the following steps one by one.

Firstly, insert three command buttons.

1. Click Developer > Insert > Command Button, see screenshot:

doc create stopwatch 2

2. Then drag the mouse to draw a button, after inserting the button, you can change the button caption, please click Developer > Properties, in the Properties dialog, enter the new caption “Start” for this button in the textbox beside the Caption, see screenshots:

doc create stopwatch 3  2 doc create stopwatch 4

3. Repeat the above two steps to insert other two buttons and caption them as “Stop” and “Reset”, see screenshot:

doc create stopwatch 5

4. After inserting the buttons, you should exit the design mode by clicking Developer > Design Mode.

Secondly, create a VBA code.

5. And then, right click the current worksheet tab, and choose View Code, in the popped out Microsoft Visual Basic for Applications window, please copy and paste the following code into the Module:

VBA code: Create stopwatch:

Public StopIt As Boolean
Public ResetIt As Boolean
Public LastTime
Private Sub CommandButton1_Click()
Dim StartTime, FinishTime, TotalTime, PauseTime
StopIt = False
ResetIt = False
If Range("C2") = 0 Then
  StartTime = Timer
  PauseTime = 0
  LastTime = 0
  StartTime = 0
  PauseTime = Timer
End If
  If StopIt = True Then
    LastTime = TotalTime
    Exit Sub
    FinishTime = Timer
    TotalTime = FinishTime - StartTime + LastTime - PauseTime
    TTime = TotalTime * 100
    HM = TTime Mod 100
    TTime = TTime \ 100
    hh = TTime \ 3600
    TTime = TTime Mod 3600
    MM = TTime \ 60
    SS = TTime Mod 60
    Range("C2").Value = Format(hh, "00") & ":" & Format(MM, "00") & ":" & Format(SS, "00") & "." & Format(HM, "00")
    If ResetIt = True Then
      Range("C2") = Format(0, "00") & ":" & Format(0, "00") & ":" & Format(0, "00") & "." & Format(0, "00")
      LastTime = 0
      PauseTime = 0
    End If
    GoTo StartIt
  End If
End Sub
Private Sub CommandButton2_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  StopIt = True
End Sub
Private Sub CommandButton3_Click()
  Range("C2").Value = Format(0, "00") & ":" & Format(0, "00") & ":" & Format(0, "00") & "." & Format(0, "00")
  LastTime = 0
  ResetIt = True
End Sub

doc create stopwatch 6

Note: In the above code, C2 is the cell where the stopwatch time will be inserted, and the CommandButton1, CommandButton2, CommandButton3 are the button names, you can view the exact button name from the Name Box, see screenshot:

doc create stopwatch 7

Thirdly, format the stopwatch time cell.

6. Then you should format the time cell as Text format, and you can change the cell size, font, font color, background, etc. as you need, see screenshot:

doc create stopwatch 8

7. After finishing above steps, from now on, when you click Start button, the time will be start now, and click Stop button, it will stop time, the Reset button will reset the time, see screenshot:

doc create stopwatch 9

Demo: Create a stopwatch with three buttons by using VBA code

Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Nhoeun Nou · 2 months ago
    Thank for your tip, It was running smoothly but when I input any data in this sheet It's stopped running, We need it keep running awhile input data How we can fix this problem?
    • To post as a guest, your comment is unpublished.
      skyyang · 2 months ago
      Hello, Nhoeun,
      May be there in not a good way for solving your problem. When you edit a cell, it will interrupt the currently executed macro.
      If you have any other good method, please comment here!
      Thank you!
  • To post as a guest, your comment is unpublished.
    Yuval · 4 months ago
    Hi, I'm using this stopper but quite often the numbers in the display cell ("C2") start fricking out and go off - they show minus signs, the digits are incorret and the count is lost. It usually happens after about an hour or more but sometimes even before an hour goes by. Is this a common bug? and if yes, is there a way to fix it? I did remove the .00 (i.e. the miliseconds) from the code by simply erasing the: & "." & Format(0, "00") line wherever it appears - does that have to do anything with this problem?
  • To post as a guest, your comment is unpublished.
    Damian · 1 years ago
    Is there any way to have the timer reset the count to zero but still keep the timer running? Ie. When I press Reset, I don't want to have to press Start again for the time to tick up.
  • To post as a guest, your comment is unpublished.
    Vivek Nath · 1 years ago
    Is it possible to automatically stop the timer when screen locks and start the timer automatically when we unlock the computer?
  • To post as a guest, your comment is unpublished.
    Tor-Bjørn Øverbø · 1 years ago
    Great, but is it possible to run 2 clocks in the same sheet? have made a second clock with new start, stop and reset buttom, but when starting the second clock the first one stops....
    • To post as a guest, your comment is unpublished.
      Vishal Sharma · 1 years ago
      same here can you able to find cure of this
      • To post as a guest, your comment is unpublished.
        skyyang · 1 years ago
        Hello, friends,
        This method is only applied to one set of buttons in a worksheet.
        If there are other good ideas, please comment here.