View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Richard
 
Posts: n/a
Default Automatically running code

The code works fine, but how and where do you put it for it to start
automatically and run continually. I have it in a Module but I have to
manually go in and run it
from there. If I put it in Private Sub Workbook_Open() it only shows the
current time when opened and does not run continually.

Sub clock()
If ThisWorkbook.Worksheets(1).Range("C2").Value = "X" Then Exit Sub
ThisWorkbook.Worksheets(1).Range("G2").Value = Format(Now, "hh:mm:ss AM/PM")
Application.OnTime Now + TimeSerial(0, 0, 60), "clock"
End Sub
Thanks in Advance!