You are here:

Excel/Auto Calculate =now()


Hello Bob,

I need your help once again.

I have an excel sheet that has a 3 cells, A1 is =now() B1 is "Duedate" and C1 is "Time Remaining.

Formula on C1 is =B1-A1.

I want C1 to change every seconds as if it is an analog timer. and A1 should be like an analog clock I found the following codes but it does not allow me to close the sheet, it reopens when I closed it.

Can you please help me identifying the issue, or maybe you have a better codes for this?

Dim nextRun As Date
Dim NextTick
Option Explicit

Sub StartMacro()
'Run this macro to start "YourMacro"
Call ReRun
End Sub

Sub ReRun()
'This automatically runs "YourMacro" each specified interval
nextRun = Now + TimeValue("00:00:01")
Application.OnTime nextRun, "ReRun"
Call YourMacro
End Sub

Sub YourMacro()
Range("A1") = Now
NextTick = Now + TimeValue("00:00:01")
Application.OnTime NextTick, "YourMacro"
End Sub

Sub Auto_Close()
'Turns off the OnTime event when closing the file
Call StopMacro
End Sub

Sub StopMacro()
'Run this to turn off the OnTime event
On Error Resume Next
Application.OnTime nextRun, "ReRun", schedule:=False
End Sub

it looks like you need to also include NextTick in the StopMacro:
Sub StopMacro()
'Run this to turn off the OnTime event
On Error Resume Next
Application.OnTime nextRun, "ReRun", schedule:=False
Application.OnTime nextTick, "Yourmacro", schedule:=False
End Sub
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Bob Umlas


I`m a Microsoft Excel MVP (Most Valuable Professional) and have been since the inception of the program in 1995. I can answer every kind of Excel question except: API, Importing/exporting to other programs (powerpoint, word,...) Also check out my in-person training link at


Worked with MS Excel since version 0.99 (on the Mac!). Was contributing editor to Excellence Magazine, having written >300 articles. John Walkenbach said of me "I finally met someone who knows as much about Excel as I do."

Excellence, The Expert, Microsoft

BA in math, Hofstra University, 1965

Awards and Honors
Led sessions for the Convergence 2004-2006 seminar on Excel tips & tricks

©2017 All rights reserved.