1

If I write function like AVG MIN MAX Worksheet.Range.Formula works, but for IF statement it doesnt work and throws Exception from HRESULT: 0x800A03EC, this is my code:

private void writeCp(int letter, int positionY)
{
    string code = "=IF(" + (char)letter + "11=0;\"Cp > 100\";(" + (char)letter + "7-" + (char)letter + "6)/(6*" + (char)letter + "11))";
    ws.Cells[12, positionY].Formula = code;
}
  • what are the values for (letter, positionY) you'r calling the code with – jalsh Aug 17 '20 at 06:44
  • It seems, that you are not the only one: https://stackoverflow.com/questions/7099770/hresult-0x800a03ec-on-worksheet-range According to the post, this error is occurring when you work with an old (xls) workbook opened in Excel 2007 or 2010. If this is the case, try first to save the file as new format workbook, before you access the cells. – Syed Muhammad Munis Ali Aug 17 '20 at 08:15
  • letter is ASCI code of character of excel collumn, positionY is excel row – Tomáš Popík Aug 17 '20 at 11:01
  • still doesnt work if i save it before writing in collumn – Tomáš Popík Aug 17 '20 at 11:02

0 Answers0