Reputation: 13756
Is there a way to apply custom formatting if value in cell is less then 0 set color to be RED.
I know how to do this by setting color for individual cell, but what I have is 8 reports with lots of cells and I just want to apply this rule on whole sheet, so I don't have to do it for each cell.
Thanks in advance.
Upvotes: 1
Views: 1249
Reputation: 13756
There is no way to do it in interop lower than 12 version.
I have changed version of interop.excel to 14 for Excel 2010 and its working with
FormatCondition f = (FormatCondition)r.FormatConditions.Add(XlFormatConditionType.xlCellValue,
XlFormatConditionOperator.xlLess, 0, misValue, misValue,
misValue, misValue, misValue);
f.Font.Color = ColorTranslator.ToOle(Color.Red);
FormatCondition property
Upvotes: 3