I write a code with C# and Microsoft.Office.Interop.Excel. In generated a drop-down list where one can chose between "okay", "delete", "else". Now I want that the cell becomes red if "delete" is chosen. I tried to do this with Excel.FormatCondition:
Excel.FormatCondition condition = mysheet.get_Range("J2:J10",
Type.Missing).FormatConditions.Add(Type:Excel.XlFormatConditionType.xlTextString,
Operator: Excel.XlFormatConditionOperator.xlEqual, Formula1: "=\"delete\"");
condition.Interior.ColorIndex = 3;
With this code I get an error:
System.Runtime.InteropServices.COMException: 'Exception from HRESULT: 0x800A03EC'