I was trying to create a button that whenever I press it, it retrieves data from Bloomberg. I know I can directly use BDP function, but I want to also be able to enter a number into this cell to manually override it. So the button is used for pulling from BBG to populate the cell, but I can also manually enter data into this cell.
I use below code to do it:
Sub RefreshBloombergData()
Dim ticker As String
ticker = Range("C9").Value
'C9 is the currency ticker
Range("D9").Value = Application.Run("BDP", ticker & " BGN Curncy", "RQ002")
End Sub
However, it appears that the button can only do its job for the first click. And if I make a minor tweak in code and run it again, the cell will give the "#N/A Requesting" error message. Is it an issue with frequently pulling data from Bloomberg? Or is there something wrong with my code.
Thank you!
Some says that pulling real time bbg data can lead to this issue. I change the field code from RQ002 to PR002 but it didn't work.
It would probably be easier to simply set the formula in that cell (not tested):
Range("D9").FormulaR1C1 = "=BDP(R[-1]&"" BGN Curncy"", ""RQ002"")"