|
Junior Member
|
|
Location: Lakehurst, NJ, USA
Posts: 19
|
|
Quote:
Originally Posted by MerseyBeat
"Paga Mike" wrote in message
...
;1605440 Wrote:
On Tuesday, September 11, 2012 3:36:34 PM UTC-4, (unknown) wrote:-
Are there other functions beside NOW() that I can use to have the
correct time displayed in a cell ?-
For some reason it does not update all the time - there are pauses in
the updates. So I'm looking for a time function that reflects the
current time (hh:mm:ss) continuosly over the course of the day.
To get a cell (say B9) to display an updating time, run the StartClock
macro listed below:
Dim PleaseStopMe As Boolean
Sub StopIt()
PleaseStopMe = True
End Sub
Sub StartClock()
PleaseStopMe = False
Do
Range("B9").Value = Format(Now, "hh:mm:ss")
DoEvents
If PleaseStopMe Then Exit Sub
Loop
End Sub
To stop the clock, run the StopIt macro
The StartClock macro provides a solution to the specific request of the OP
(ie: "continuosly over the course of the day"). It is, however, a
continuous, iterative loop that, once started, will never end. Once
StartClock begins, you cannot stop it by running StopIt because StartClock
is still running its endless loop.
|
Actually, you can stop it by running the StopIt macro. The DoEvents statement allows the user to share focus with the macro.
Try it
|