条件付き書式で1行おき色塗り

 

Sub test()
’ 条件付き書式で1行おき色塗り

    With Selection
        .FormatConditions.Delete
        ’ 数式を使用して、書式を設定
        .FormatConditions.Add Type:=xlExpression, Formula1:="=mod(row(),2)=1"
        .FormatConditions(1).Interior.ColorIndex = 20
    
    End With
End Sub

 

実行結果

 

― ― ― ― ― ― ― ― ― ― → Excel VBA基礎入門もくじ へ戻る 

 

参考記事