I'm working on a spreadsheet where the user has to type a given text into a cell at a certain time. I want to put a side countdown timer so it goes by checking how much time is still missing. However, when I start typing in the cell, the stopwatch function stops working (stops counting), and only returns after I hit Enter. I'm new to VBA, maybe it's some configuration, or where I'm running the subroutines, and I do not know yet.
The countdown routines are as follows:
Private Sub Iniciar_crono()
starttimer
End Sub
Sub starttimer()
Application.OnTime Now + TimeValue("00:00:01"), "nexttick"
End Sub
Sub nexttick()
If Plan3.Range("E3") = 0 Then
Exit Sub
End If
Plan3.Range("E3").Value = Plan3.Range("E3").Value - TimeValue("00:00:01")
If Plan3.Range("E3").Value <= TimeValue("00:00:10") Then
Plan2.Shapes("TextBox 1").Fill.ForeColor.RGB = RGB(255, 0, 0)
Else
Plan2.Shapes("TextBox 1").Fill.ForeColor.RGB = RGB(255, 255, 255)
End If
starttimer
End Sub
Private Sub Parar_crono()
stoptimer
End Sub
Sub stoptimer()
On Error Resume Next
Application.OnTime Now + TimeValue("00:00:01"), "nexttick", , False
End Sub
For guidance: - A button to start the counter calls the start_chrome () - A button to stop it calls Stop_chrome () - It's all done today in Module 1