Telefonstolpe
Board Regular
- Joined
- Sep 25, 2014
- Messages
- 55
Hi,
I've got a macro that, when activated, counts the time in seconds in cell F2, starting on zero.
That macro works perfectly well.
However it's the third Macro "StopTimer" that doesn't work and I cannot figure out why.
Error Message: "Run-time error '1004': Method 'OnTime of object '_Application' failed"
Sub StartTimer()
Application.OnTime Now + TimeValue("00:00:01"), "Increment_count"
End Sub
Sub Increment_count()
Range("F2").Value = Range("F2") + 1
StartTimer
End Sub
Sub StopTimer()
Application.OnTime Now + TimeValue("00:00:01"), "Increment_count", Schedule:=False
End Sub
Is there somebody who can see what I have don wrong?
Regards /Chris
I've got a macro that, when activated, counts the time in seconds in cell F2, starting on zero.
That macro works perfectly well.
However it's the third Macro "StopTimer" that doesn't work and I cannot figure out why.
Error Message: "Run-time error '1004': Method 'OnTime of object '_Application' failed"
Sub StartTimer()
Application.OnTime Now + TimeValue("00:00:01"), "Increment_count"
End Sub
Sub Increment_count()
Range("F2").Value = Range("F2") + 1
StartTimer
End Sub
Sub StopTimer()
Application.OnTime Now + TimeValue("00:00:01"), "Increment_count", Schedule:=False
End Sub
Is there somebody who can see what I have don wrong?
Regards /Chris
Last edited: