Sub test()
Dim A, B(3 To 5), j, k
Rows(2).Interior.ColorIndex = 0
For k = 3 To 5
'1)找最值
A = Range([a2], Cells(2, Cells(2, Columns.Count).End(1).Column + k))
B(k) = A(1, 1 + k)
For j = 1 To UBound(A, 2) Step 6
If Len(A(1, j + k)) Then
If k = 4 Then
If B(k) > (0 + A(1, j + k)) Then B(k) = A(1, j + k)
Else
If B(k) < (0 + A(1, j + k)) Then B(k) = A(1, j + k)
End If
End If
Next j
'2)填色
Debug.Print B(k)
For j = 1 To UBound(A, 2) Step 6
If B(k) = A(1, j + k) Then Cells(2, j + k).Interior.ColorIndex = k
Next j
Next k
End Sub
4.rar
(18.2 KB, 下载次数: 9)