0
I have the following code:
newWorksheet.Cells[1, 1] = "Status";
var var1 = newWorksheet.Cells[2, 1] as Excel.Range;
var1.Formula = "=CONT.SE(Planilha1!B2:B7;'Ativo')";
newWorksheet.Cells[3, 1] = "=CONT.SE(Planilha1!B2:B7;'Bloqueado";
The First cell, "Status" is not an error. But from the second, in this line:
var1.Formula = "=CONT.SE(Planilha1!B2:B7;'Ativo')";
makes the mistake:
System.Runtime.InteropServices.COMException: 'Exceção de HRESULT: 0x800A03EC'
Can you help me?
I’m using the library: Microsoft.Office.Interop.Excel;
When you insert it like this:
newWorksheet.Cells[1, 1] = "Status";
newWorksheet.Cells[2, 1].Formula =
"CONT.SE(Planilha1!B2:B7;\"Ativo\")";
The Text is inserted into the cell. However, I need it as a formula, i.e., the "=" before the text.
Good note. But the error gives in a row above. srsrsrsrs.
– Rebeca Nonato