Stop Start Timer

ghorne

New Member
Joined
Nov 26, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Good afternoon, could someone assist me in creating a timer. I have a form that I created and use and column I contained yes,no and n/a answers. What I would like to measure how long it takes someone to complete a review. So the timer would start when cell i9 is selected with a yes, no or n/a and the timer stops when cell i35 is selected with a yes, no or n/a.
The timer will need to be displayed on a hidden tab that only I can view.. Thanks
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
See if something like this works for you. It doesn't use a timer, but simply saves the actual times when I9 and I35 contain yes, no or n/a and puts the time difference in A1 of the "Time" sheet.

Put this code in the sheet module of the sheet containing the I9 cell.

VBA Code:
Dim startTime As Date
Dim endTime As Date

Private Sub Worksheet_Change(ByVal Target As Range)
        
    If Target.Address = "$I$9" And InStr(1, ",yes,no,n/a,", "," & Target.Value & ",", vbTextCompare) Then
        startTime = Now
    ElseIf Target.Address = "$I$35" And InStr(1, ",yes,no,n/a,", "," & Target.Value & ",", vbTextCompare) Then
        endTime = Now
        Worksheets("Time").Range("A1").Value = Format(endTime - startTime, "HH:MM:SS")
    End If
        
End Sub
 
Upvote 0
Thanks for this information, it is very much appreciated. I'll give it a try and let you know. Thanks again.
See if something like this works for you. It doesn't use a timer, but simply saves the actual times when I9 and I35 contain yes, no or n/a and puts the time difference in A1 of the "Time" sheet.

Put this code in the sheet module of the sheet containing the I9 cell.

VBA Code:
Dim startTime As Date
Dim endTime As Date

Private Sub Worksheet_Change(ByVal Target As Range)
       
    If Target.Address = "$I$9" And InStr(1, ",yes,no,n/a,", "," & Target.Value & ",", vbTextCompare) Then
        startTime = Now
    ElseIf Target.Address = "$I$35" And InStr(1, ",yes,no,n/a,", "," & Target.Value & ",", vbTextCompare) Then
        endTime = Now
        Worksheets("Time").Range("A1").Value = Format(endTime - startTime, "HH:MM:SS")
    End If
       
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,503
Messages
6,179,136
Members
452,890
Latest member
Nikhil Ramesh

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