Excel fails to show formula result after adding formula from C# - Interop - Excel
Posted on 2011-03-17
I'm using Office 2003 running on XP SP 2, .NET FW 3.5, Visual Studio 2010
I'm positive that I've found a bug in Excel or maybe in Interop.Excel.
Via my Excel objects I'm writing a simple formula ta cell:
for (int row = numberOfDataRows; row >= 2; row--)
xlRow = (Excel.Range)xlSheet.Rows[row];
Excel.Range thisCell = (Excel.Range)xlRow.Cells[1, 2];
thisCell.Formula = "=MONTH(a" + row.ToString() + ")";
When I look at the result in the Excel file there are #NAME? in all cells where I added the formula to BUT in the FORMULA bar I can see the correct formula.
Now, if I click inside the Formula bar followed by an ENTER -> voila, the value of the cell is evaluated according to the formula. I don't know how-to solve this what I think is a bug so please, anyone here, help needed ASAP!