如何用VBA进行隔行填色
主要VBA代码如下:
方法一:
Sub 隔行填色1()
Range("A2").EntireRow.Select
Do While ActiveCell.Value <> ""
Selection.Interior.ColorIndex = 3
ActiveCell.Offset(2, 0).EntireRow.Select
Loop
End Sub
方法二:
Sub 隔行填色2()
Dim LRow As Long
LRow = 2
Do Until IsEmpty(Cells(LRow, 1))
Cells(LRow, 1).EntireRow.Interior.ColorIndex = 3
LRow = LRow + 2
Loop
End Sub
方法三:
Sub 隔行填色3()
Dim LRow As Long
LRow = 0
Do
LRow = LRow + 2
If IsEmpty(Cells(LRow, 1)) Then Exit Do
Cells(LRow, 1).EntireRow.Interior.ColorIndex = 3
Loop
End Sub