hi guys,
have a stock price/volume spreadsheet that updates in realtime.
goal is to run a macro that loops every second between 09:00:00 and 09:30:00 and copies all the cells from bVolume/aVolume (columns I/K) to corresponding columns O/Q, but only if values are nonzero
therefore, if the bVolume/aVolume is zero for any given price, it will not overwrite the previous copied volume
have attempted to write macro in attached s/s but can't quite perfect it
please help!
Dim timeToRun
Sub copyPrices()
timeToRun = Now + TimeValue("00:00:01")
Application.OnTime timeToRun, "rangePaste"
End Sub
Sub rangePaste()
Dim ocell, qcell As Range
For Each ocell In Range("I4:I65")
If IsNumeric(ocell) Then
ocell.Copy (Range("O4:O65"))
Next ocell
For Each qcell In Range("K4:K65")
If IsNumeric(qcell) Then
qcell.Copy (Range("Q4:Q65"))
End If
Next qcell
If Now < "9:29:58" Then
Call copyPrices
Else: Exit Sub
End If
End Sub
matchtest2.xlsm
Bookmarks