System clock start/end button.

Jaloko

New Member
Joined
Dec 14, 2016
Messages
4
So, I know how to make a simple time Variance between times entered manually.

But what I want to do is have a button that you can click and it will grab the time from your System clock, record that in a cell. I suppose I will do the same with the end time as well. I then want to have it record the variance between those 2 times.

I know to do this manually by entering the time but I want to make it easier by simply having it pull the time directly from the system clock using a start button and end button.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Make two ActiveX buttons (Developer Tab - Insert - Command Button ActiveX control)
Right click on each and choose properties. Change the Name and the caption for each.
Double click on each button with Designer Mode on
Add the following code just like I did:

Code:
Private Sub StartTime_Click()  
Range("I3") = Now() - Int(Now())
  Range("I4") = Now() - Int(Now())
  
End Sub


Private Sub EndTime_Click()
  Range("I4") = Now() - Int(Now())
End Sub

Turn Designer mode off
In Cel I5 put: =I4-I3
Format cells I3:I5 with this format: h:mm:ss;@

The start button adds the current time to both the Start Time and End Time Cells. The End Time Button puts the current time in the End Time Cell
 
Last edited:
Upvote 0
Code:
Private Sub StartTime_Click()  
Range("I3") = Now() - Int(Now())
  Range("I4") = Now() - Int(Now())
  
End Sub


Private Sub EndTime_Click()
  Range("I4") = Now() - Int(Now())
End Sub

You could replace ...
= Now() - Int(Now())

With...
= Now - Date

Or this...
= Time
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,264
Members
449,075
Latest member
staticfluids

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