RICONOMICS87
New Member
- Joined
- Aug 22, 2019
- Messages
- 2
[FONT="]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></o>[/FONT]
[FONT="]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></o>[/FONT]
[FONT="]I'm a newbie to coding and anewbie to MRExcel. my desperation has led me to seek professional help<o></o>[/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.
[FONT="]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></o>[/FONT]
[FONT="]I'm a newbie to coding and anewbie to MRExcel. my desperation has led me to seek professional help<o></o>[/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.