user9078057
user9078057

Reputation: 269

How to "plant" bloomberg function BDP into cell VBA

I have the following problem, Say I have the following cell (very simplified): CBA 4.5 01/22/2019, I want to use VBA to plant a BDP() function in the adjacent cell in order to find out what the ISIN is. Without excel I would use =BDP(A1 & " Corp"; "ID_ISIN")right?

I am attempting to insert this function in VBA, and it does not work:

TOMS.Cells(1, 2).Value.Formula = "=BDP(" & TOMS.Cells(1, 1).Value & " Corp, ID_ISIN)"

Any ideas?

Upvotes: 1

Views: 2322

Answers (1)

Scott Craner
Scott Craner

Reputation: 152505

You forgot the " inside the formula, which must be doubled in vba:

 TOMS.Cells(1, 2).Formula = "=BDP(""" & TOMS.Cells(1, 1).Value & " Corp"", ""ID_ISIN"")"

Upvotes: 5

Related Questions