VBA/Excel/Access/Word/Excel/Row Format
Содержание
Select every other row and apply the formatting:
Sub ShadeEverySecondRow()
range("A2").EntireRow.Select
Do While ActiveCell.value <> ""
Selection.Interior.ColorIndex = 15
ActiveCell.offset(2, 0).EntireRow.Select
Loop
End Sub
Shade every second row
Sub ShadeEverySecondRow()
Range("A2").EntireRow.Select
Do While ActiveCell.Value <> ""
Selection.Interior.ColorIndex = 15
ActiveCell.Offset(2, 0).EntireRow.Select
Loop
End Sub
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
Shade every second row by using the Do Until Loop
Sub ShadeEverySecondRow()
Dim lRow As Long
lRow = 2
Do Until IsEmpty(cells(lRow, 1))
cells(lRow, 1).EntireRow.Interior.ColorIndex = 15
lRow = lRow + 2
Loop
End Sub