附件 如果满意请给最佳
Sub xx()
Set rng = Range("L4:AE22")
For Each cell In rng
If cell >= 0 And cell <= 2 Then
cell.Interior.ColorIndex = 3
ElseIf cell >= 3 And cell <= 6 Then
cell.Interior.ColorIndex = 4
ElseIf cell >= 7 And cell <= 9 Then
cell.Interior.ColorIndex = 5
End If
Next
End Sub
Sub color()
Dim i As Long
Dim j As Long
For i = 4 To 22
For j = 12 To 31
If Cells(i, j) >= 0 And Cells(i, j) <= 2 Then
Cells(i, j).Interior.ColorIndex = 3
Else
If Cells(i, j) >= 3 And Cells(i, j) <= 6 Then
Cells(i, j).Interior.ColorIndex = 4
Else
If Cells(i, j) >= 7 And Cells(i, j) <= 9 Then
Cells(i, j).Interior.ColorIndex = 5
End If
End If
End If
Next
Next
Sub color()
Dim i As Long
Dim j As Long
For i = 4 To 22
For j = 12 To 31
If Cells(i, j) >= 0 And Cells(i, j) <= 2 Then
Cells(i, j).Interior.ColorIndex = 3
Else
If Cells(i, j) >= 3 And Cells(i, j) <= 6 Then
Cells(i, j).Interior.ColorIndex = 4
Else
If Cells(i, j) >= 7 And Cells(i, j) <= 9 Then
Cells(i, j).Interior.ColorIndex = 5
End If
End If
End If
Next
Next
End Sub