Alternate Row Colors in Range

前端 未结 8 1646
轻奢々
轻奢々 2020-12-09 13:13

I\'ve come up with the following to alternate row colors within a specified range:

Sub AlternateRowColors()
Dim lastRow as Long

lastRow = Range(\"A1\").End(         


        
8条回答
  •  Happy的楠姐
    2020-12-09 13:15

    set these up initialized somewhere:

    Dim arr_Lng_Row_Color(1) As Long
    arr_Lng_Row_Color(0) = RGB(int_Color_1_R, int_Color_1_G, int_Color_1_B)
    arr_Lng_Row_Color(1) = RGB(int_Color_2_R, int_Color_2_G, int_Color_2_B)
    

    On any row you wish this will set the color

    ws_SomeSheet.Rows(int_Target_Row).EntireRow.Interior.Color = arr_Lng_Row_Color(int_Target_Row Mod 2)
    
    

提交回复
热议问题