NOW() Function PROBLEM SOLVED, NICELY TOO

elgringo56

Well-known Member
Joined
Apr 15, 2002
Messages
869
When using the NOW() function, the date and time are displayed, but the time remains static from that point on. Is there a function that will allow the date and time to display and the time to incriment with the clock?
This message was edited by elgringo56 on 2002-08-22 23:37
 
or put it in the status bar

Sub Z()
Application.OnTime now + TimeValue("00:00:1"), "Z"
Calculate
x = Format(now(), "hh:mm:ss")
Application.StatusBar = x
End Sub

Brett
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
On 2002-08-22 21:07, Jay Petrulis wrote:
Hi Brett,

Nice job.

Another option to try...

<pre>Sub test()

With Application
.OnTime Now, "test"
.Caption = Now
End With
End Sub</pre>

Nice one see above
 
Upvote 0
On 2002-08-22 21:04, brettvba wrote:
Well This will do it and leave you working give it a try.

Sub Z()
Application.OnTime now + TimeValue("00:00:1"), "Z"
If Range("a1").Value <> now() Then Calculate
End Sub


Brett

Thats pretty kewl, Brett. I had to add an ApplicationRun Z to my workbook open, but that works perfect. Thanks millions and Trillions.
 
Upvote 0
Caution, dont put that in until the last thing you do because if you try and do a record macro with it in, it will show up in your macro and it will make it very hard to add code to the macor. But other than that, it works greag
 
Upvote 0
On 2002-08-22 23:21, elgringo56 wrote:
On 2002-08-22 21:04, brettvba wrote:
Well This will do it and leave you working give it a try.

Sub Z()
Application.OnTime now + TimeValue("00:00:1"), "Z"
If Range("a1").Value <> now() Then Calculate
End Sub


Brett

Thats pretty kewl, Brett. I had to add an ApplicationRun Z to my workbook open, but that works perfect. Thanks millions and Trillions.
To Tidy Up

Module

Sub Z()
Application.OnTime Now + TimeValue("00:00:01"), "Z"
If Range("a1").Value <> Now() Then Calculate
End Sub
Sub x()
Application.OnTime Now + TimeValue("00:00:01"), "Z", Schedule:=False
End Sub

ThisWorkbook Module

Private Sub Workbook_BeforeClose(Cancel As Boolean)
x
End Sub

Private Sub Workbook_Open()
Z
End Sub

The Sub Proceedure "x" will stop the on time proceedure,

Brett
 
Upvote 0
I know this is dragging up an old thread, but I used this methord (and it works), however, you cannot copy and paste unless you do it within a second. Is there any way to get this clock to update every minute instead of every second, or to gain back the copy/paste funtionality?
 
Upvote 0
It also cooks Undo. Why not instead use any desktop clock?
 
Upvote 0
You could use OnTime to recalculate the workbook periodically, which could cause conditional formatting to reevaluate. Less glitz, but less impact.
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,595
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top