Adding A "Timer" to a Macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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)
 
Hi Bob. Tried to contact you direct last week on this one. Cannot get the
timer to work. Do I need to download the code ?

regards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top