Clock?

S

scottnshelly

How can i put a clock on a spreadsheet? i know the formula that wil
put the current time, but i want a clock that will keep time. is thi
possible
 
S

scottnshelly

thanks. unfortunatley this is for work and i can't download anything o
the work computers. no big deal. just wanted to spruce up a workboo
or two.
thanks for the help guys
 
S

Steve Garman

I don't really recommend it, especially as most PCs already have plenty
of clocks but you could try something like this:

Private Sub Worksheet_Activate()
Set clockCell = Range("a1")
showTime
End Sub

Private Sub Worksheet_Deactivate()
On Error Resume Next
Application.OnTime clockTim, "showTime", , False
End Sub

'
'Then in a module
'

Public clockTim As Variant
Public clockCell As Range
Public Sub showTime()
clockCell.Value = Format(Now, "'hh:mm:ss")
clockTim = Now + TimeValue("00:00:01")
Application.OnTime clockTim, "showTime"
End Sub
 
S

scottnshelly

Thanks, that a good one. You say you don't recommend it though? is i
dangerous, or will it slow anything down?
thanks again
 
S

Steve Garman

Any unnecessary code will slow things down a bit.

I don't think this is particularly greedy code, but it's something else
that could potentially go wrong.

Mostly, though, I just don't recomend clocks in general unless there's a
specific reason for them. As a user, I find them irritating.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top