hi everyone.
I made a macro awhile ago to record some live data after any change in the data i had coming into an excel sheet from a RTD/DDE link.. it was simple and worked fine for what i needed.
But now I have another project where i need to record some data coming in but only at longer intervals every 15 sec to 30 secs and not every time there is a change which could be every second or multiple times a second. I'm not sure if my macro can be tweaked or if i need to start from scratch any help is appreciated. I copy and pasted the VBA code for macro below.
Thanks again!
I made a macro awhile ago to record some live data after any change in the data i had coming into an excel sheet from a RTD/DDE link.. it was simple and worked fine for what i needed.
But now I have another project where i need to record some data coming in but only at longer intervals every 15 sec to 30 secs and not every time there is a change which could be every second or multiple times a second. I'm not sure if my macro can be tweaked or if i need to start from scratch any help is appreciated. I copy and pasted the VBA code for macro below.
Code:
Private Sub Worksheet_Calculate()
If Time >= TimeValue("10:00:00") And Time <= TimeValue("11:30:00") Then
C = Range("A" & Rows.Count).End(xlUp).Row 'Identifies last row in Column A with data
D = Range("J" & Rows.Count).End(xlUp).Row 'Identifies last row in Column J with data
If C <= 1048575 Then
Range("A" & C + 1).Value = Range("A1").Value
Range("B" & C + 1).Value = Range("B1").Value
Range("C" & C + 1).Value = Range("C1").Value
Range("D" & C + 1).Value = Range("D1").Value
Range("E" & C + 1).Value = Range("E1").Value
Range("F" & C + 1).Value = Range("F1").Value
Range("G" & C + 1).Value = Range("G1").Value
Range("H" & C + 1).Value = Range("H1").Value
ElseIf D <= 1048575 Then
Range("J" & D + 1).Value = Range("A1").Value
Range("K" & D + 1).Value = Range("B1").Value
Range("L" & D + 1).Value = Range("C1").Value
Range("M" & D + 1).Value = Range("D1").Value
Range("N" & D + 1).Value = Range("E1").Value
Range("O" & D + 1).Value = Range("F1").Value
Range("P" & D + 1).Value = Range("G1").Value
Range("Q" & D + 1).Value = Range("H1").Value
Else
Exit Sub
End If
End If
End Sub
Thanks again!
Last edited: