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
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,077
Latest member
Jocksteriom

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
Back
Top