|
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 rng.Interior.Color = i Then k = k + rng.Value: n = n + 1
Next
MsgBox "最后平均分为:" & k / n & "分"
End
100:
MsgBox "查找功能没有拾取到颜色!"
End Sub
|
|