Data Recording Macro Tweak

AA1323

New Member
Joined
Sep 23, 2014
Messages
1
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.


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:

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,215,001
Messages
6,122,648
Members
449,092
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top