Shade every second row by using the Do Loop : Row Format « Excel « VBA / Excel / Access / Word






Shade every second row by using the Do Loop

 
     Sub ShadeEverySecondRow()
         Dim lRow As Long
         lRow = 0
         Do
             lRow = lRow + 2
             If IsEmpty(cells(lRow, 1)) Then Exit Do
             Rows(lRow).Interior.ColorIndex = 15
         Loop
     End Sub

 








Related examples in the same category

1.Shade every second row
2.Select every other row and apply the formatting:
3.Shade every second row by using the Do Until Loop