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

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
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,216,496
Messages
6,130,983
Members
449,611
Latest member
Bushra

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