Hello All,
I've created a stopwatch macro to create a start time and a stop time as well as a Duration section, however, the people that will be using this stopwatch often pause the stopwatch to go to lunch, or a break. My start and stop macros are functioning properly, however, when I click on the pause button the stopwatch stops instead of pausing. I was hoping someone could help me in creating a pause macro that will pause the stopwatch and then allow the start button to resume the time. This way the total amount of time will be captured. I've included the code I'm currently using as well as my sample file so everyone can see how the macros are currently working. Here is the code:
Here is the link to the sample file: Stopwatch Macro
I appreciate any help anyone can provide. Thank you.
D.
I've created a stopwatch macro to create a start time and a stop time as well as a Duration section, however, the people that will be using this stopwatch often pause the stopwatch to go to lunch, or a break. My start and stop macros are functioning properly, however, when I click on the pause button the stopwatch stops instead of pausing. I was hoping someone could help me in creating a pause macro that will pause the stopwatch and then allow the start button to resume the time. This way the total amount of time will be captured. I've included the code I'm currently using as well as my sample file so everyone can see how the macros are currently working. Here is the code:
VBA Code:
Public interval As Date
Sub Start_Timer()
Range("F1:F10000").Find("").Select
ActiveCell.Value = Time
Selection.NumberFormat = "hh:mm:ss"
End Sub
Sub Pause_Timer()
On Error Resume Next
Call Stop_Timer
Application.OnTime EarliestTime:=interval, Procedure:="Start_Timer", Schedule:=False
End Sub
Sub Stop_Timer()
Range("G1:G10000").Find("").Select
ActiveCell.Value = Time
Selection.NumberFormat = "hh:mm:ss"
Range("H1:H10000").Find("").Select
ActiveCell.Value = Format(Time, "Long Time")
ActiveCell.FormulaR1C1 = "=RC[-1] - RC[-2]"
Selection.NumberFormat = "hh:mm:ss"
End Sub
Here is the link to the sample file: Stopwatch Macro
I appreciate any help anyone can provide. Thank you.
D.