VBA: Bloomberg Requesting Data

nicolehalliday

Board Regular
Joined
May 19, 2010
Messages
56
Hi everyone,

So I have a macro that first changes the dates in a cell, which in turn changes the values in a range. The values in this range are supported by a Bloomberg add-in and are the historical high price of the day for some stocks. The values in this range change when I change the dates in cell EF1. I then copy the new values and paste them into a table.

The macro runs properly, but when I change the date Excel needs to request the data from Bloomberg, and sometimes it can take a while to load. The speed of my macro is much faster, and so I end up copying the cells while they are loading and it says "#N/A Requesting Data...". I have put some Application.Updates into the macro but it doesn't make a difference. What I believe is happening is that the Bloomberg data can't be recieved while a macro is running... Is that true? Here is my code, any suggestions or ideas would be great, thank you!!!

Code:
Sub highs()

Application.ScreenUpdating = False
If Sheets("highs").Range("EE1") = Range("evaldate").Value Then
    MsgBox "Updated"
    
Else
    'enters date into cell
    Sheets("highs").Select
    Range("EF1").Formula = "=WORKDAY(EE1,1)"
       Sheets("lows").Select
    Range("EF1").Formula = "=WORKDAY(EE1,1)"
    
   Sheets("update").Select
   'range of cells is referenced to EF1 in 'highs'
   Application.Calculate
   'selects range of cells and copy/pastes into the main table
   Range("d2").Select
   Application.Calculate
   Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    Sheets("highs").Select
    Application.Run "BLPLinkReset"
    Range("ef2").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    'deletes least recent date range (so table has a rollover effect)
    Columns("Z:Z").Select
    Selection.delete Shift:=xlToLeft
    Range("DZ1").Select
        
End If
End Sub
 

Some videos you may like

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Watch MrExcel Video

Forum statistics

Threads
1,123,304
Messages
5,600,862
Members
414,409
Latest member
FloordAlex

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