heffo500

New Member
Joined
Sep 28, 2016
Messages
44
Hi

I am having issue with me code below it inserts the code into all the cells except cell U2, Can anybody tell me where I am going wrong?

Range("R2").Formula = "=IF(AND(A3=""Subtotal"",LEN(C3)=3,H3<>0),INDEX(Sheet2!E:E,MATCH(1,INDEX((G3=Sheet2!B:B)*(K3=Sheet2!C:C),0),0)),"""")"
Range("S2").Formula = "=IF(R2="""","""",-H3*R2)"
Range("T2").Formula = "=IF(R2="""","""",L3-S2)"
Range("U2").Formula = "=IF(LEN(C2)=2,SUMIFS(T:T,B:B,C2),"")"
Range("V2").Formula = "=IF(U2="""","""",U2/L2)"
Range("W2").Formula = "=IF(V2="""","""",IF(ABS(V2)>0.035,""YES"",""NO""))"
Range("X2").Formula = "=IF(V2="""","""",INDEX(Sheet4!M:M,MATCH(1,INDEX((""585031 "" & C2=Sheet4!B:B)*(ISNUMBER(Sheet4!L:L)),0),0)))"
Range("Y2").Formula = "=IF(V2="""","""",IF(W2=X2,""OK"",""BREAK""))"
Range("R2:Y2").Copy
Range("R3:Y" & lr).PasteSpecial

Thanks
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
You didn't double up the quotes in the formula:

Rich (BB code):
Range("U2").Formula = "=IF(LEN(C2)=2,SUMIFS(T:T,B:B,C2),"""")"
 
Upvote 0
If you look at every other formula you use """". In that one you just have "". You have to use """".
 
Upvote 0

Forum statistics

Threads
1,215,300
Messages
6,124,138
Members
449,144
Latest member
Rayudo125

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