Code to write formula with a cell reference

qwertty

New Member
Joined
Jun 22, 2011
Messages
2
I have a worksheet with hundreds of Bloomberg formulas in it that I need to change regularly. I only need to change the date information, everything else stays the same (see the formula below). What I'd like to do is enter a new date in a cell and run a macro to change all the previous dates to this new date. A simple Find & Replace macro won't work because I need to update the formulas with dates from the prior two weeks (they overlap eachother using find/replace).

Here's one of the formulas I need to change:


=BDH("CL1 Comdty","PX_LAST","6/24/2011","6/24/2011","Dir=V","Dts=H","Sort=A","Quote=C","QtTyp=P","Days=A","Per=cd","DtFmt=D","Fill=P","UseDPDF=Y")

Basically, I want the macro to write the formula as you see it, but with a reference to a cell with the new date (e.g., change "6/24/2011" to some new date). Bloomberg requires the formula to appear EXACTLY as above.

I want to do something similiar to what I found in this thread but I'm having trouble getting it to work: http://www.mrexcel.com/forum/showthread.php?t=64290

I'm a relative newb with VBA. PLEASE HELP!
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,216,377
Messages
6,130,261
Members
449,568
Latest member
mwl_y

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