私のプロジェクトでは、次のようなセル値の条件に基づいてセルの背景色をフォーマットするコードがあります。
//if value is 1 than colorIndex is 3;
Excel.FormatCondition condition = colorRange.FormatConditions.Add(
Type: Excel.XlFormatConditionType.xlTextString,
Operator: Excel.XlFormatConditionOperator.xlEqual,
Formula1: "=1");
condition5.Interior.ColorIndex = 3;
この条件は正常に機能しますが、次のコードの条件は機能しません。
//if value is Red Color than colorIndex is 3;
Excel.FormatCondition condition = colorRange.FormatConditions.Add(
Type: Excel.XlFormatConditionType.xlTextString,
Operator: Excel.XlFormatConditionOperator.xlEqual,
Formula1: "=Red Color");
condition5.Interior.ColorIndex = 3;
表示されるエラー メッセージは「パラメーターが正しくありません」です。
私は何を間違っていますか?