但是我發現數據範圍在0以及負數時無法區分...
Sub run_map()
'
' run_map Macro
' Administrator 在 2010/9/17 錄製的巨集
'
Dim myresult(20, 20) As Long
Dim x, y As Long
Dim SH, SL, R1, R2, R3, R4 As Long
SH = Range("D14").Value
SL = Range("D15").Value
R1 = Range("D16").Value
R2 = Range("F16").Value
R3 = Range("H16").Value
R4 = Range("J16").Value
For x = 4 To 13
For y = 5 To 17
myresult(x, y) = Cells(x, y).Value
Next y
Next x
For x = 4 To 13
For y = 5 To 17
If myresult(x, y) = False Then
Cells(x, y).Interior.ColorIndex = 2
Else
If myresult(x, y) >= SL And myresult(x, y) < R1 Then
Cells(x, y).Interior.ColorIndex = 35
ElseIf myresult(x, y) >= R1 And myresult(x, y) < R2 Then
Cells(x, y).Interior.ColorIndex = 36
ElseIf myresult(x, y) >= R2 And myresult(x, y) < R3 Then
Cells(x, y).Interior.ColorIndex = 44
ElseIf myresult(x, y) >= R3 And myresult(x, y) < R4 Then
Cells(x, y).Interior.ColorIndex = 45
ElseIf myresult(x, y) >= R4 And myresult(x, y) <= SH Then
Cells(x, y).Interior.ColorIndex = 46