rhettblaine
New Member
- Joined
- Oct 3, 2013
- Messages
- 29
- Office Version
- 365
- Platform
- Windows
Hey guys,
A couple of months ago I found an extremely amazing VBA code for a stop watch that starts, pauses, and clears by clicking on 3 different cells instead of using buttons or shapes.
The company that I was working for was bought out and I (and no one else that I sent it to) was able to send a copy. I was able to save the code.
The only thing is that with this new company, it's not working as intended. The only way I can call the vba is by resorting to buttons. Even then, I can only activate the timer. I cannot pause/restart or clear.
Here is the code. I'm hoping that someone can let me know where to start. I cannot reference the site that I found this as the site is no longer active.
Also, I placed this under 'Modules' as well as in the Sheets. It does not work if I place it in the Sheets.
A couple of months ago I found an extremely amazing VBA code for a stop watch that starts, pauses, and clears by clicking on 3 different cells instead of using buttons or shapes.
The company that I was working for was bought out and I (and no one else that I sent it to) was able to send a copy. I was able to save the code.
The only thing is that with this new company, it's not working as intended. The only way I can call the vba is by resorting to buttons. Even then, I can only activate the timer. I cannot pause/restart or clear.
Here is the code. I'm hoping that someone can let me know where to start. I cannot reference the site that I found this as the site is no longer active.
Also, I placed this under 'Modules' as well as in the Sheets. It does not work if I place it in the Sheets.
Code:
Public NextTime As Date
'This is located at the very top of the code module
Sub Call_Timer()
NextTime = Now + TimeValue("00:00:01")
ThisWorkbook.Sheets("Time").Range("D1").Value = ThisWorkbook.Sheets("Time").Range("D1").Value + 1 / 86400
Application.OnTime NextTime, "Call_Timer"
End Sub
Sub UpdateTimer()
If ActiveCell.Address = "$A$1" Then
If NextTime = 0 Then Call_Timer
ElseIf ActiveCell.Address = "$B$1" Then
If NextTime > 0 Then Application.OnTime NextTime, "Call_Timer", Schedule:=False
NextTime = 0
ElseIf ActiveCell.Address = "$C$1" Then
Range("D1").Value = 0
End If
End Sub
Sub StatReset()
'
' StatReset Macro
'
'
Range("D8").Select
ActiveSheet.PivotTables("TimeStudyStats").PivotCache.Refresh
End Sub