交替填充截图
Sub test_fill()
Dim i, j As Long
Dim odd, even As Integer
Dim tianchong As Integer
odd = 2
even = 15
Sheets(1).Activate '选中指定的第一个工作表(索引号为1),并使其成为活动工作表。
For i = 2 To Range("A1048576").End(xlUp).Row
'对标题行之外的表格范围,按行交替填充单元格颜色
If i Mod 2 = 1 Then '根据i的奇偶性分别使用odd或even的值来设置颜色值。
tianchong = odd
Else
tianchong = even
End If
'开始填充当前行单元格
For j = 1 To Cells(1, 16384).End(xlToLeft).Column
Sheets(1).Cells(i, j).Interior.ColorIndex = tianchong
Next j
Next i
End Sub