View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
David Farber David Farber is offline
external usenet poster
 
Posts: 21
Default Updating the NOW() function every minute.

"David Farber" wrote in message
...
I have a worksheet that calculates some astronomical positions according
to the current time of day. Of course as time progresses, the numbers
change. I found a few websites that provide a copy and paste routine in
VB format but I can't seem to get them to update the time every minute
without manually doing a refresh. It's only one cell that needs updating
every minute and the rest of the calculations should automatically follow
from that. I am using Excel 2002. I know some programming languages but
VB isn't one of them. Also, if anyone can point me to a small subroutine
to do this, I'd be appreciative.

Thanks for your reply.
--
David Farber
L.A., CA


"Danny Boy" <d_a_n_n_y_r_a_t_h_o_t_m_a_i_l_d_o_t_c_o_u_k wrote in message
...
I guess the issue here will be whether or not you need to work on the
computer whilst the procedure is running. There are a few ways to do what
you want providing you are happy to let machine run the procedure.

In the ThisWorkBook Open module you can call the following procedure. I
have included a counter which you can configure - here it set to 5
minutes.

Sub getTime()

Dim Rng As Range
Dim count As Integer

Set Rng = ActiveWorkbook.Worksheets("Sheet1").Cells(1, 1)

count = 0
Do
If Second(Now) = 0 Then
Rng.Value = Format(Now, "hh:mm:ss")
count = count + 1
MsgBox count
End If
Loop Until count = 5
End Sub


Yes, I definitely want to be able to use the machine while this is running.
So if this procedure prohibits that, I will not be able to implement it.

Thanks for your reply.

David Farber
L.A., CA