BuffaloGuy
New Member
- Joined
- Dec 5, 2017
- Messages
- 28
My code was working perfectly, then I messed with it (only a little!). I was originally copying cells C3:G3, and copying them to the new worksheet. I extended it to include a few more cells that are running an exponetial moving average calculation, and the code runs for 5 or 6 lines before I get the Subscript out of range error. Thoughts?
VBA Code:
Option Explicit
Dim TimeToRun
Sub MacroRun()
TimeToRun = Now + TimeValue("00:01:00")
Application.OnTime TimeToRun, "Macro1"
End Sub
Sub Macro1()
Calculate
Worksheets("Calculation").Range("C3:M3").Copy
Worksheets("Data").Cells(Rows.Count, "C").End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Application.CutCopyMode = False
MacroRun
End Sub
Sub stopMacros()
On Error Resume Next
Application.OnTime TimeToRun, "Macro1", , False
End Sub