• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Update Bloomberg data in each loop

qiuzhangb

New Member
Hello!

There is a problem bothering me for days..... I've been trying to write a macro with following steps:
1) Put in a date
2) Retrieve Bloomberg data (with formulas including BDH, BCurveStrip, BCurveFwd...) based on that date
3) Calculate the result
4) Copy and paste the result into a different cell

I have tried to google and asked Bloomberg many times, but the codes I found are not working in my macro. (since I'm a rookie)

Could you please help me to look at the codes below? The code is simplified because I've taken out all the BCurve part in order to solve it from root. This macro now keeps running without pasting the calculation result and I don't know what's wrong......

Many many thanks!!!!

Code:
Public Sub FindReturn()
  Call Worksheets("Model").Activate
  
  
  Dim i As Integer
  
  For i = 30 To 31
  
  
  
  Cells(11, 6).Value = Cells(i, 27).Value
  
  If calc_sheet = True Then
  
  'Save the return
  
  Cells(i, 31).Value = Cells(4, 12).Value
  Cells(i, 32).Value = Cells(5, 12).Value
  
  End If
  
  Next i
  
 
End Sub

Function calc_sheet() As Boolean
Dim tmp
Dim c As Object
tmp = False
ActiveSheet.Calculate
ActiveSheet.Calculate
With ActiveSheet.UsedRange
  Set c = .Find("request", LookIn:=xlValues)
  If Not c Is Nothing Then
  Application.OnTime Now + TimeValue("00:00:05"), "calc_sheet"
  tmp = False
  Else
  tmp = True
  End If
End With
calc_sheet = tmp
End Function
 
Back
Top