將每個工作表的總分列進行操作:判斷總分,<60,底色爲紅色,60-100,底色爲藍色,100以上:底色爲綠色
Sub test()
For Each y In Worksheets
x = y.UsedRange.Rows.Count
For i = 2 To x
If x <= 60 Then
x = y.Cells(i, "I")
y.Cells(i, "I").Interior.ColorIndex = 3
ElseIf x <= 100 Then
y.Cells(i, "I").Interior.ColorIndex = 33
Else
y.Cells(i, "I").Interior.ColorIndex = 43
End If
Next
Next
End Sub