I have a very similar problem to this thread: Increment a cell value with a timer - tried adding a comment to that rather than posting a new thread, but didn't have reputation of 50, so here I am.
I have a timer in my Excel sheet in cell B7 which counts down, and I have buttons to start and stop the timer which work well. When the timer reaches zero, I would like the value in cell B8, currently set to 1, to increment by 1, and I would like it to do this each time the timer is reset and subsequently goes back down to zero.
The code below is what I have just for the timer itself, without trying to increment the value in B8:
Public interval As Date
Sub timer()
interval = Now + TimeValue("00:00:01")
If Range("B7").Value = 0 Then Exit Sub
Range("B7") = Range("B7") - TimeValue("00:00:01")
Application.OnTime interval, "timer"
End Sub
Sub stop_timer()
Application.OnTime EarliestTime:=interval, Procedure:="timer", Schedule:=False
End Sub
The problem occurs when I try to change the timer macro to "If Range("B8").Value = 0 Then Range("B8").Value = Range("B8").Value+1
I've tried playing around with it a few different ways, but ultimately I get some type of syntax error or broken expression, or the start/stop buttons just stop working. I'm sure I'm missing something simple and/or there's probably another way to do this, but I know next-to-nothing about VBA and only managed to get this far through some searching online and lots of tinkering, so would appreciate help and guidance from anyone that is able to offer it.
Thanks!