Sub aaa()
Dim D, X%, I%
Dim Arr
Arr = Sheet1.Range("A1:B10").Value
Set D = CreateObject("Scripting.Dictionary")
For I = 1 To UBound(Arr, 1)
If Not D.Exists(Arr(I, 1)) Then
D(Arr(I, 1)) = Arr(I, 2)
Else
D(Arr(I, 1)) = IIf(D(Arr(I, 1)) > Arr(I, 2), Arr(I, 2), D(Arr(I, 1)))
End If
Next
Debug.Print 1
End Sub
给你个框架,自己改一下就好了