Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default help with a special timer

I'm trying to build a timer which would place a time stamp sharply each
minute in a column like this:

10:30:00 AM
10:31:00 AM
10:32:00 AM

Can anyone help me debug my code as it doesn't want to move down below the
first cell?

Public Sub timer()
Dim Lag
Lag = 60 - Second(Now())
If Second(Now()) = 0 Then
Worksheets("Sheet1").Cells(2, 3).Value = Format(Now(), "hh:mm:ss AM/PM")
End If
If Second(Now()) 0 Then
Application.OnTime Now() + TimeSerial(0, 0, Lag), "Rounder"
End If
End Sub

Public Sub Rounder()
Worksheets("Sheet1").Cells(2, 3).Value = Format(Now(), "hh:mm:ss AM/PM")
Application.OnTime Now() + TimeSerial(0, 0, Lag), "My_time"
End Sub

Sub My_time()
Dim RunWhen
Dim TimeRunner
TimeRunner = Range("C2").Value
RunWhen = TimeRunner + TimeSerial(0, 1, 0)
Application.OnTime RunWhen, "Update"
End Sub

Sub Update()
Dim Destination As Range
Set Destination = _
Worksheets("Sheet1").Cells(Rows.Count, 3).End(xlUp).Offset(1, 0)
Destination.Value = RunWhen
End Sub

***********************
Thanks,
Vladi


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default help with a special timer

Set a variable, say Dest, as range.
Set Dest = Range("C2")
Then place the time in the Dest cell.
Then after the line of code that places the time in Dest, set Dest =
Dest.Offset(1)
HTH Otto
"Vladi" wrote in message ...
I'm trying to build a timer which would place a time stamp sharply each
minute in a column like this:

10:30:00 AM
10:31:00 AM
10:32:00 AM

Can anyone help me debug my code as it doesn't want to move down below the
first cell?

Public Sub timer()
Dim Lag
Lag = 60 - Second(Now())
If Second(Now()) = 0 Then
Worksheets("Sheet1").Cells(2, 3).Value = Format(Now(), "hh:mm:ss
AM/PM")
End If
If Second(Now()) 0 Then
Application.OnTime Now() + TimeSerial(0, 0, Lag), "Rounder"
End If
End Sub

Public Sub Rounder()
Worksheets("Sheet1").Cells(2, 3).Value = Format(Now(), "hh:mm:ss AM/PM")
Application.OnTime Now() + TimeSerial(0, 0, Lag), "My_time"
End Sub

Sub My_time()
Dim RunWhen
Dim TimeRunner
TimeRunner = Range("C2").Value
RunWhen = TimeRunner + TimeSerial(0, 1, 0)
Application.OnTime RunWhen, "Update"
End Sub

Sub Update()
Dim Destination As Range
Set Destination = _
Worksheets("Sheet1").Cells(Rows.Count, 3).End(xlUp).Offset(1, 0)
Destination.Value = RunWhen
End Sub

***********************
Thanks,
Vladi



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Stopping a Timer / Running a timer simultaneously on Excel Paul23 Excel Discussion (Misc queries) 1 March 10th 06 12:08 PM
vba timer William Barnes[_2_] Excel Programming 2 August 16th 05 10:14 PM
Msg Box Timer Steph[_3_] Excel Programming 13 March 18th 05 06:40 PM
timer nyn04[_7_] Excel Programming 1 September 23rd 04 12:04 PM
Dynamic Copy/Paste Special Formulas/Paste Special Values Sharon Perez Excel Programming 3 August 7th 04 09:49 PM


All times are GMT +1. The time now is 05:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"