0
'理想情況下,我想循環到下面輸出範圍的最後一列(E6
),然後在5,10和10秒範圍內運行移動平均值。 15,20,25至50間隔爲移動平均期間...在時間序列上運行移動平均值,間隔爲5循環到最後一列
基本上我想清理這裏的代碼。我不是專業的編碼員。將欣賞一些建議。
列C
是價格數據 E6
是我希望它從最後均線即50
表填寫姓名跨越的「數據」
Sub Mov_Avgs()
'last row
Dim Lastrow As Long
Lastrow = Range("C" & Rows.Count).End(xlUp).Row
Application.Run "ATPVBAEN.XLAM!Moveavg", ActiveSheet.Range("$C$6:$C" & Lastrow), _
ActiveSheet.Range("E6"), 5, False, False, False
Application.Run "ATPVBAEN.XLAM!Moveavg", ActiveSheet.Range("$C$6:$C" & Lastrow), _
ActiveSheet.Range("F6"), 10, False, False, False
Application.Run "ATPVBAEN.XLAM!Moveavg", ActiveSheet.Range("$C$6:$C" & Lastrow), _
ActiveSheet.Range("G6"), 15, False, False, False
Application.Run "ATPVBAEN.XLAM!Moveavg", ActiveSheet.Range("$C$6:$C" & Lastrow), _
ActiveSheet.Range("H6"), 20, False, False, False
Application.Run "ATPVBAEN.XLAM!Moveavg", ActiveSheet.Range("$C$6:$C" & Lastrow), _
ActiveSheet.Range("I6"), 25, False, False, False
Application.Run "ATPVBAEN.XLAM!Moveavg", ActiveSheet.Range("$C$6:$C" & Lastrow), _
ActiveSheet.Range("J6"), 30, False, False, False
Application.Run "ATPVBAEN.XLAM!Moveavg", ActiveSheet.Range("$C$6:$C" & Lastrow), _
ActiveSheet.Range("K6"), 35, False, False, False
Application.Run "ATPVBAEN.XLAM!Moveavg", ActiveSheet.Range("$C$6:$C" & Lastrow), _
ActiveSheet.Range("L6"), 40, False, False, False
Application.Run "ATPVBAEN.XLAM!Moveavg", ActiveSheet.Range("$C$6:$C" & Lastrow), _
ActiveSheet.Range("M6"), 45, False, False, False
Application.Run "ATPVBAEN.XLAM!Moveavg", ActiveSheet.Range("$C$6:$C" & Lastrow), _
ActiveSheet.Range("N6"), 50, False, False, False
End Sub