VBA:单元格实例(格式化工资条),拾取的颜色求平均

Sub 格式化工资条()
Dim i%
i = Cells(Rows.Count, 1).End(xlUp).Row
For j = 1 To i
    If j Mod 2 Then
        With Cells(j, 1).EntireRow.Range("a1:g1").Font
            .Bold = True
            .Size = 8
            .ColorIndex = 56
        End With
    Else
        With Cells(j, 1).EntireRow.Range("a1:g1").Interior
            .ColorIndex = 40
        End With
    End If
Next j
End Sub

Sub 清除格式化()
Selection.ClearFormats
End Sub
VBA:单元格实例(格式化工资条),拾取的颜色求平均_第1张图片

案例二:

Sub 根据查找功能拾取的颜色求平均()
    On Error GoTo 100
  Dim erng As Range, rng As Range, i As Long
  i = Application.FindFormat.Interior.Color
  Set erng = Cells(Rows.Count, "e").End(xlUp)
  For Each rng In Range([b2], erng)
    If

你可能感兴趣的:(VBA,excel,学习)