Private Sub Worksheet_Change(ByVal Target As Range)
Dim c
If Target.Row = 2 Then
c = getMax(Cells(2, Columns.Count).End(1).Column)
Rows(2).Interior.ColorIndex = 0
Cells(2, c).Interior.ColorIndex = 4
End If
End Sub
Function getMax(c)
Dim k, A, j, x, y
k = 3 '偏移3列
A = Range([a2], Cells(2, c + k))
For j = 1 To UBound(A, 2) Step 6
If x < A(1, j + k) Then x = A(1, j + k): y = j + k
Next j
getMax = y
End Function
找出最大值2.rar
(13.24 KB, 下载次数: 12)