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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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,215,336
Messages
6,124,332
Members
449,155
Latest member
ravioli44

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