2016-06-30 12 views
0

列(L)<>列(H)の場合、2つの異なる列のデータに対して条件付き書式を設定するにはどうすればよいですか。私が望む形式は、行全体に対して、Font:Red、BackFill:Yellowで構成されています。VBAを使用して2つの異なる列の範囲で条件付き書式設定

これはこれまで私が行ってきたことです。

With Range("H:H,L:L") 
     .FormatConditions.Delete 
     .FormatConditions.Add Type:=xlExpression, Formula1:="=$H1<>$L1" 
     With Range("H:H,L:L").FormatConditions(1).Font 
      .Color = -16776961 
      .TintAndShade = 0 
     End With 
    End With 
+0

これは間違っていますか? –

答えて

0

エラーはありません。ご迷惑をおかけして申し訳ございませんが、私は解決策を見つけました。

  With Rows("1:1048576") 
     .FormatConditions.Delete 
     .FormatConditions.Add Type:=xlExpression, Formula1:="=AND(ROW()<>1,$H1<>$L1)" 
     With Rows("1:1048576").FormatConditions(1).Font 
      .Bold = True 
      .Color = -16776961 
     End With 

     With Rows("1:1048576").FormatConditions(1).Interior 
      .PatternColorIndex = xlAutomatic 
      .Color = 65535 
     End With 
    End With 
関連する問題