Reputation: 19
In Excel, A1 is equal to =B1/ BDP(C11&”Corp”, “ds036”)
Which BDP(Corp, ds036)
is a function and parameters from Bloomberg.
How to use Excel VBA for this formula?
I was trying different ways in VBA to solve my point. One of them is like the line below,
Cells(1,1)=“B1/ BDP(C11&”Corp”, “ds036”)”
An other way I tried, to simplify,
For i=1 to10
Cells(i,1)=“Cells(i,2)/ BDP(cells(i,3)&”Corp”, “ds036”)”
Next
Also, if it can access directly to BDP function. That will be perfect!
Upvotes: 0
Views: 612
Reputation: 4486
Does this do what you want?
Range("A1:A10").Formula = "=B1/BDP(C3&""Corp"",""ds036"")"
If you assign a formula to a multi-cell range, I think Excel will automatically adjust relative cell references for subsequent rows/columns - similar to CTRL+D or dragging down.
This means you don't need to loop through each row and re-construct the formula string for each loop iteration.
Upvotes: 0
Reputation: 96781
try:
Cells(1,1).Formula = "=B1/ BDP(C11&""Corp"", ""ds036"")"
Note:
Upvotes: 2