Hi Guys,
New here. I am building a spread to analyze several securities trading indicators by extracting data from my trading platform. I found a template on your forum from 2012 that works great. The information updates in the cells and I have already applied a macro to record the entries as they change on any time interval I need.
My issue is how it is recorded. At the moment it simply begins filling in a column in a descending fashion to whatever range I want then essentially stops once it fills up the allotted cells. This is no good as I need the data to scroll like a live feed from top to bottom (Most recent to oldest). Basically have the live cell at the top then after each update have it bumped down a cell until it reaches...say 100 then is pushed out of the data range.
The current code is below. There are stop and start timer entries which aren't relevant to my problem.
Public RunWhen As Double
Public Const cRunIntervalSeconds = 1 ' 1 second, set 900 for 15 minute intervals
Public Const cRunWhat = "Mess" ' the name of the procedure to run
Sub StartTimer()
RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
Application.OnTime EarliestTime:=RunWhen, Procedure:=cRunWhat, _
Schedule:=True
End Sub
Sub Mess()
Range("C1") = Range("C1") + 1
Dim Crng As Range, Prng As Range
Set Crng = Worksheets(1).Range("B4:G4")
Set Prng = Worksheets(1).Range("B33").End(xlUp).Offset(1, 0)
Crng.Copy
Prng.PasteSpecial (xlPasteValues)
StartTimer
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime EarliestTime:=RunWhen, Procedure:=cRunWhat, _
Schedule:=False
End Sub
Through my other research I found another code which does exactly what I need but, despite it being used live in a YouTube video I can't get it to work properly. Any thoughts on combining the two would be glorious.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:A1")) Is Nothing Then
Application.EnableEvents = False
Range("D2:D31").Value = Range("D1:D30").Value
Application.EnableEvents = True
End If
End Sub
Bookmarks