Hey!
So I have the following:


xlSCOApp.Range("B5" & i).Formula = "=IF(OR(A5" & i & "={""V586M "",""L80L86""}),550,IF(OR(A5" & i & "={""M585M"",""L81L85""}),600,IF(OR(A5" & i & "={""N580M"",""N581M""}),350,IF(OR(A5" & i & "={""C550VP"",""C551VP""}),300,IF(OR(A5" & i & "={""B4V"",""B5V"",""B22D"",""B23D""}),300,IF(OR(A5" & i & "={""E8V"",""E9V"",""D6V"",""D7V"",""M20D"",""M21D"",""D4W"",""D5W""}),100,IF(OR(A5" & i & "={""T25"",""T27"",""T28""}),0,""0"")))))))"

That is all in a for loop and thats why "i" is there...

So the above code works fine but when I try to copy/paste another IF at the end of that like:


IF(OR(A5" & i & "={""T25"",""T27"",""T28""}),0,

I get this error in visual studio:

Exception from HRESULT: 0x800A03EC

I'm assuming the problem is with the formula but it doesn't make any sense because all im doing is copy/pasting which I did for the rest of that formula... Now when I need to add one more it errors?! Dont know...


For example, this wont work:


xlSCOApp.Range("B5" & i).Formula = "=IF(OR(A5" & i & "={""V586M "",""L80L86""}),550,IF(OR(A5" & i & "={""M585M"",""L81L85""}),600,IF(OR(A5" & i & "={""N580M"",""N581M""}),350,IF(OR(A5" & i & "={""C550VP"",""C551VP""}),300,IF(OR(A5" & i & "={""B4V"",""B5V"",""B22D"",""B23D""}),300,IF(OR(A5" & i & "={""E8V"",""E9V"",""D6V"",""D7V"",""M20D"",""M21D"",""D4W"",""D5W""}),100,IF(OR(A5" & i & "={""T25"",""T27"",""T28""}),0,IF(OR(A5" & i & "={""T109"",""T101"",""T2""}),23,""0""))))))))"

The code in red is what i added, and now doesnt work!
Thanks,
Sean