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
 
You could use OnTime to recalculate the workbook periodically, which could cause conditional formatting to reevaluate. Less glitz, but less impact.

every minute would be great. How can I do that?


oh, I almost forgot. The x macro errors out "Method 'OnTime' of object '_Application' failed". Is that part even necessary?
 
Last edited:
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
What is all of the code you have now?
 
Upvote 0
What is all of the code you have now?

Module

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

ThisWorkbook Module

Private Sub Workbook_BeforeClose(Cancel As Boolean)
x
End Sub

Private Sub Workbook_Open()
Z
End Sub
 
Upvote 0
Code:
' Standard module</SPAN>
 
Option Explicit</SPAN>
 
Dim tWhen As Date</SPAN>
 
Sub Calc()</SPAN>
    Calculate</SPAN>
    tWhen = Now() + TimeSerial(0, 0, 1)</SPAN>
    Application.OnTime EarliestTime:=tWhen, _</SPAN>
                       Procedure:="Calc"</SPAN>
End Sub</SPAN>
 
Sub StopCalc()</SPAN>
    Application.OnTime EarliestTime:=tWhen, _</SPAN>
                       Procedure:="Calc", _</SPAN>
                       Schedule:=False</SPAN>
End Sub</SPAN>
 
' ThisWorkbook Module</SPAN>
 
Option Explicit</SPAN>
 
Private Sub Workbook_Open()</SPAN>
    Calc</SPAN>
End Sub</SPAN>
 
Private Sub Workbook_BeforeClose(Cancel As Boolean)</SPAN>
    StopCalc</SPAN>
End Sub</SPAN>
 
Upvote 0

Forum statistics

Threads
1,216,030
Messages
6,128,407
Members
449,448
Latest member
Andrew Slatter

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