I'm executing two lines of code to pull data with BDP Formulas from Bloomberg (I have about 95,000 lines of data). The problem which is occuring is the "convert cells to values" line of code occurs before all the formulas have finished pulling in the data from Bloomberg. Is there a way to delay the "convert cells to values" line of code to ensure the data formulas have finished pulling the data first?
Sub BloombergFormula()
Dim LastRow As Long
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
With Sheets("FullFile")
.Range("P2:P" & LastRow).FormulaR1C1 = "=IF(LEFT(IF(RC[-2]=""Cusip""," & _
"RC[-3],IF(RC[-1]="""","""",BDP(RC[-1],""ID_CUSIP""))),4)=""#N/A"",""""," & _
"IF(RC[-2]=""Cusip"",RC[-3],IF(RC[-1]="""","""",BDP(RC[-1],""ID_CUSIP""))))"
.Range("Q2:Q" & LastRow).FormulaR1C1 = "=IF(LEFT(BDP(RC[-2],""ID_ISIN""),4)=""#N/A"","""",BDP(RC[-2],""ID_ISIN""))"
.Range("P2:Q" & LastRow) = .Range("P2:Q" & LastRow).Value
End With
End Sub
Bookmarks