I have a file that needs to be updated first thing every morning and then at periodic times throughout the day. What I currently have is an OnTime macro that will refresh the information every 30 minutes. Sometimes it takes longer than 30 minutes first thing in the morning to get everything done, and if the macro refreshes it messes everything up.
What I want is a macro that will refresh immediately, stop, and then start refreshing automatically at 9am. I tried using the following, but it didnt accomplish the 2nd part of what I want.
Help! Thanks!
What I want is a macro that will refresh immediately, stop, and then start refreshing automatically at 9am. I tried using the following, but it didnt accomplish the 2nd part of what I want.
Help! Thanks!
Code:
Sub TestOnTime()
Application.OnTime Now, "macro1"
Application.OnTime TimeValue("13:04:25"), "Macro2"
End Sub
Sub Macro1()
Range("a1:a10").Copy
Range("IV1").Activate
Selection.End(xlToLeft).Select
ActiveCell.Offset(0, 1).PasteSpecial
' Application.CutCopyMode
End Sub
Sub Macro2()
Application.OnTime Now + TimeValue("00:00:05"), "Macro2"
Range("a1:a10").Copy
Range("IV1").Activate
Selection.End(xlToLeft).Select
ActiveCell.Offset(0, 1).PasteSpecial
' Application.CutCopyMode
' Application.OnTime Now + TimeValue("00:00:05")
End Sub