Auto Refresh Time

  • Thread starter Thread starter klick_80
  • Start date Start date
K

klick_80

Hey all, I want to have a running Time Stamp in Cell A1

I've tried =NOW() and once the time changes it doesn't update less
save, and reopen. I know this is a very basic question, but i was tol
it had to do with macros. If anyone knows, it would help me out greatl
 
the NOW function will always show date/time sheet was last calculated -
so to get it to continously update you need to have it constantly being
recalculated - which will use memory - IF you really need this then you
will need a macro - but you might want to consider WHY you need it?
 
Paste the folllowing in a standard module:
'---------------------------------------
Option Explicit

Dim dTimer As Date

Sub initTimer()
Range("A1").Value = Now
dTimer = Now + TimeSerial(0, 0, 1)
Application.OnTime dTimer, "InitTimer"
End Sub

Sub stopTimer()
Application.OnTime dTimer, "InitTimer", , False
End Sub
'----------------------------------------

and the following in ThisWorkbook code:
'-------------------------------------------
Option Explicit

Private Sub Workbook_BeforeClose(Cancel As Boolean)
stopTimer
End Sub

Private Sub Workbook_Open()
initTimer
End Sub
'--------------------------------------------

HTH
--
AP


"klick_80" <[email protected]> a écrit
dans le message de (e-mail address removed)...
 
I not an expert in reading these codes yet, so one simple question: How often
does this code refresh the data? And how do I set the refresh frequency to
ex. 1 sek or 1 minute?
 
Sorry, I can get this code to work. Nothing happens. I have put the code in
the two different places: Module 1 and This workbok. What's wrong?
 
I have a workbook created by Bob Phillips which is a demo of exactly the kind
of continuous background time display you describe. It uses API calls.
Unforunately, I don't remember the URL where I downloaded it. The file's name
is "Interactive Clock v5.1.xls" Bob Phillips is a big name on these forums,
so it may not be hard to find his website & and the file. Otherwise, I am
happy to e-mail it to you.

Regards,

Hutch
 

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

Back
Top