Good Afternoon,
Please will someone advise me on the correct syntax for a Do Until Loop to a specific time. The procedure below produces a compile error.
Any help will be much appreciated.
Rob.
Please will someone advise me on the correct syntax for a Do Until Loop to a specific time. The procedure below produces a compile error.
Code:
Sub Phase2()
Dim i As Integer
'Application.ScreenUpdating = False
'Workbooks("Data Collection Template Ver 2.xlsm").Activate
Do Until Application.OnTime TimeValue("07:02:00"),
Sheets("Data Collection and Compilation").Select
Range("h2:h3006").Copy
Selection.Offset(-1, 0).Value = Now
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.Offset(1, 0).Select
Selection.FormulaR1C1 = "=AVERAGE(R[-1]C[-5]:R[-1]C)"
For i = 1 To 1502
Selection.Offset(2, 0).Select
Selection.FormulaR1C1 = "=AVERAGE(R[-1]C[-5]:R[-1]C)"
Next i
Selection.Offset(-3005, 1).Select
Loop
End Sub
Rob.