I'm trying to fill an Excel 2010 cell programatically via COM Interop, with a string that represents an IF-formula.
The following line of code works just fine, it resolves to value 4 in Excel:
.Range("C10").Value = "=2+2"
but when I pass an IF-Formula (as String)...
.Range("C11").Value = "=IF(1+1=2;2;0)"
...I run into a COMException
, saying: Exception from HRESULT: 0x800A03EC
.
If I enter the same IF-formula directly in Excel, it is parsed correctly.
Thanks for your help!
Chris
You should replace the semicolons with commas and use
.Formula
instead.Value