View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default Adding A "Timer" to a Macro

Public nTime

Sub xx()

nTime = Now + Time(0, 0, 5) ' 5 secs
Application.OnTime nTime, "temp"

End Sub


Sub temp()
Dim iLastRow As Long

Range(Range("C2"), Range("C2").End(xlDown)).Copy
Range("F2").End(xlDown).Offset(1, 0).PasteSpecial _
Paste:=xlValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False

nTime = Now + Time(0, 0, 5) ' 5 secs
Application.OnTime nTime, "temp"
End Sub


You will need to stop it at some time


Application.OnTime nTime, "temp",,False


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"carl" wrote in message
...
I am uusing this:

Sub temp()
Range("C2").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Range("F2").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,

SkipBlanks:= _
False, Transpose:=False
End Sub

Is possible to have this macro execute every "n" seconds and when it
executes, to go to the next "free" column to paste the data - for example

on
the 2nd execution the data would get pasted in G2, 3rd execution in H2

etc.

Thank you in advance.