Populate then clear

RICONOMICS87

New Member
Joined
Aug 22, 2019
Messages
2
[FONT=&quot]I'm trying to take a snapshot of600+ different options quotes using my brokerage's RTD API, but they limit meto 100 requests at any one time.<o:p></o:p>[/FONT]
[FONT=&quot]I have a Range of cells that theRTD formulas are pasted into then once values have been generated (each cell inrange is > 0) to delete the formulas, if values have not generated thenre-paste formulas.<o:p></o:p>[/FONT]
[FONT=&quot]I'm a newbie to coding and anewbie to MRExcel. my desperation has led me to seek professional help<o:p></o:p>[/FONT]
------------------------------------------------------------------------------------------------------------------------------------------------------------
Sub FXE_CALLS_RTD()

Range("A10").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C10&""/USD"",""ASKDELTA"")" 'CALL DELTA Range("B10").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C10&""/USD"",$D$9)" 'CALL ASK '----------------------------------------------------------------------------------------- Range("A11").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C11&""/USD"",""ASKDELTA"")" 'CALL DELTA" Range("B11").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C11&""/USD"",""ASK"")" 'CALL ASK '----------------------------------------------------------------------------------------- Range("A12").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C12&""/USD"",""ASKDELTA"")" 'CALL DELTA Range("B12").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C12&""/USD"",""ASK"")" 'CALL ASK '----------------------------------------------------------------------------------------- Range("A13").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C13&""/USD"",""ASKDELTA"")" 'CALL DELTA Range("B13").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C13&""/USD"",""ASK"")" 'CALL ASK '----------------------------------------------------------------------------------------- Range("A14").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C14&""/USD"",""ASKDELTA"")" 'CALL DELTA Range("B14").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C14&""/USD"",""ASK"")" 'CALL ASK '----------------------------------------------------------------------------------------- Range("A15").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C15&""/USD"",""ASKDELTA"")" 'CALL DELTA Range("B15").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C15&""/USD"",""ASK"")" 'CALL ASK '-----------------------------------------------------------------------------------------
Call CLEARCELLS END SUB SUB CLEARCELLS Dim rng As Range, r As Range Set rng = Range("A10:A15")
For Each r In rng If r.Value > 0 Then r.Value = “” End If Next r END SUB
----------------------------------------------------------------------------------------------------------------------------------------------------

The code works halfway, I have to run it twice for it to work. I was hoping that it could run seamlessly.
 

Some videos you may like

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

RICONOMICS87

New Member
Joined
Aug 22, 2019
Messages
2
Apologies

Rich (BB code):
Rich (BB code):
Rich (BB code):
Sub FXE_CALLS_RTD()

Range("A10").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C10&""/USD"",""ASKDELTA"")" 'CALL DELTA 
Range("B10").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C10&""/USD"",$D$9)" 'CALL ASK 
'----------------------------------------------------------------------------------------- 
Range("A11").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C11&""/USD"",""ASKDELTA"")" 'CALL DELTA" 
Range("B11").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C11&""/USD"",""ASK"")" 'CALL ASK 
'----------------------------------------------------------------------------------------- 
Range("A12").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C12&""/USD"",""ASKDELTA"")" 'CALL DELTA 
Range("B12").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C12&""/USD"",""ASK"")" 'CALL ASK 
'----------------------------------------------------------------------------------------- 
Range("A13").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C13&""/USD"",""ASKDELTA"")" 'CALL DELTA 
Range("B13").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C13&""/USD"",""ASK"")" 'CALL ASK 
'----------------------------------------------------------------------------------------- 
Range("A14").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C14&""/USD"",""ASKDELTA"")" 'CALL DELTA 
Range("B14").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C14&""/USD"",""ASK"")" 'CALL ASK 
'----------------------------------------------------------------------------------------- 
Range("A15").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C15&""/USD"",""ASKDELTA"")" 'CALL DELTA 
Range("B15").Formula = "=RTD($J$1,,$A$4&""@""&""smart//OPT/""&$R$3&""/C/""&C15&""/USD"",""ASK"")" 'CALL ASK 
'-----------------------------------------------------------------------------------------

Call CLEARCELLS 
END SUB 

SUB CLEARCELLS 
Dim rng As Range, r As Range 
Set rng = Range("A10:A15")

For Each r In rng 

If r.Value > 0 Then 

r.Value = “” 

End If 
Next r 
END SUB
 

Watch MrExcel Video

Forum statistics

Threads
1,127,685
Messages
5,626,293
Members
416,172
Latest member
lordposh

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