
Originally Posted by
MarvinP
Hi score,
Add a third button and name it "Reset".
Make code for this button to
Sub ResetTimer
Sheet1.Cells(1,"B")=TimeValue("00:05:00") ' make this the time you want to reset it to
starttimer
End Sub
What this will do is simply change the value in cell B1 back to your reset value.
MarvinP... Thank you very much for taking the time to help!! it does work perfectly!!
Here the whole code to share
Sub starttimer()
Application.OnTime Now + TimeValue("00:00:01"), "nexttick"
End Sub
Sub nexttick()
If Sheet1.Range("B7") = 0 Then Exit Sub
Sheet1.Range("B7").Value = Sheet1.Range("B7").Value - TimeValue("00:00:01")
If Sheet1.Range("B7").Value <= TimeValue("00:00:10") Then
Sheet1.Shapes("TextBox 6").Fill.ForeColor.RGB = RGB(255, 0, 0)
Else
Sheet1.Shapes("TextBox 6").Fill.ForeColor.RGB = RGB(6, 13, 150)
End If
starttimer
End Sub
Sub stoptimer()
On Error Resume Next
Application.OnTime Now + TimeValue("00:00:01"), "nexttick", , False
End Sub
Sub ResetTimer()
Sheet1.Range("B7") = TimeValue("00:00:20") ' make this the time you want to reset it to
starttimer
End Sub
Bookmarks