Runtime error 424 when copying RTD(real time data) data every 5 min.

shubham_options

New Member
Joined
Jun 24, 2021
Messages
2
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
I have a column at Q in sheet OC where values are there Q3 to Q24.
These values are fetched in real time. It changes every millisecond. I have raw data in different sheet which changes every millisecond. I use vlookup function to format and give meaning to it in OC sheet in Q column.
I have created two subs

Below sub is used to keep it running every 25millisecond
Sub ATimedRecalc()
TRCopy
Application.OnTime Now + TimeValue("00:00:25"), "ATimedRecalc"
'Application.RTD.RefreshData
End Sub
This sub is used to copy data from Q3:Q24 which is based on vlookup at RTD in different sheet.
It stores data according to time mentioned in AA2 and respectively.
Sub TRCopy()

'Copy AT Excel
Dim TRPutOI As String
TRPutOI = "Q3:Q24"

If OC.Range("AA2").Value = Format(Now(), "hh:mm:00") Then --DEBUGGER STOPPED HERE with ERROR 424
If IsEmpty(OC.Range("AA3").Value) Then
OC.Range("AA3:AA24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AB2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AB3").Value) Then
OC.Range("AB3:AB24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AC2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AC3").Value) Then
OC.Range("AC3:AC24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AD2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AD3").Value) Then
OC.Range("AD3:AD24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AE2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AE3").Value) Then
OC.Range("AE3:AE24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AF2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AF3").Value) Then
OC.Range("AF3:AF24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AG2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AG3").Value) Then
OC.Range("AG3:AG24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AH2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AH3").Value) Then
OC.Range("AH3:AH24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AI2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AI3").Value) Then
OC.Range("AI3:AI24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AJ2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AJ3").Value) Then
OC.Range("AJ3:AJ24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AK2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AK3").Value) Then
OC.Range("AK3:AK24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AL2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AL3").Value) Then
OC.Range("AL3:AL24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AM2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AM3").Value) Then
OC.Range("AM3:AM24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AN2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AN3").Value) Then
OC.Range("AN3:AN24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AO2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AO3").Value) Then
OC.Range("AO3:AO24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AP2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AP3").Value) Then
OC.Range("AP3:AP24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AQ2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AQ3").Value) Then
OC.Range("AQ3:AQ24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AR2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AR3").Value) Then
OC.Range("AR3:AR24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AS2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AS3").Value) Then
OC.Range("AS3:AS24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AT2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AT3").Value) Then
OC.Range("AT3:AT24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AU2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AU3").Value) Then
OC.Range("AU3:AU24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AV2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AV3").Value) Then
OC.Range("AV3:AV24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AW2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AW3").Value) Then
OC.Range("AW3:AW24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AX2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AX3").Value) Then
OC.Range("AX3:AX24").Value = OC.Range(TRPutOI).Value
End If
ElseIf OC.Range("AY2").Value = Format(Now(), "hh:mm:00") Then
If IsEmpty(OC.Range("AY3").Value) Then
OC.Range("AY3:AY24").Value = OC.Range(TRPutOI).Value
End If
End If
 

Attachments

  • 1.png
    1.png
    6.9 KB · Views: 5

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.

shubham_options

New Member
Joined
Jun 24, 2021
Messages
2
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Maybe:
VBA Code:
If Format(OC.Range("AA2").Value, "hh:mm:00") = Format(Now, "hh:mm:00") Then
I just resolved the issue as sheet name in excel is not the same in VBA. VBA still named it as sheet1.
But new issue is that macro is running but not seeing data copied. Its blank.
 

Forum statistics

Threads
1,147,962
Messages
5,744,060
Members
423,843
Latest member
alex2022

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
Top