![]() |
Adding A "Timer" to a Macro
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. |
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. |
Adding A "Timer" to a Macro
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. "Bob Phillips" wrote: 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. |
All times are GMT +1. The time now is 11:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com