Insert IF statement into a column of cells

steven426

New Member
Joined
Jul 13, 2009
Messages
19
Hi:

I am trying to insert an IF statement into a column of cells, but I am not sure where to put the quotation marks... I am getting an "application defined or object defined" error when I run the code

here is what I have

Range(Cells(2, Agency), Cells(NUM_POS, Agency)).Formula = "=IF(OR(RC=Agncy CMO Other, RC=MBS 15yr,RC=MBS 20yr,RC=MBS 25yr,RC=MBS 30yr,RC=MBS 40yr), AGENCY, NO"


This formula will yield one of the following phrases : "CMO Other" , "MBS 15yr" "MBS 20 yr" etc...

Thanks...
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I find it easier to manually type the formula into excel, then do a macro record. Select the cell with the formula, press F2 <enter>. Stop recording. Now you will have the syntax and can modify to work in your macro.
 
Upvote 0

Forum statistics

Threads
1,215,483
Messages
6,125,063
Members
449,206
Latest member
Healthydogs

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