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