Sub 最新报价()
Dim i, j, k, arr, brr, x, y
Dim dic
Set dic = CreateObject("scripting.dictionary")
arr = Sheet1.[a1].CurrentRegion
For i = 2 To UBound(arr)
If arr(i, 1) > 0 Then
关键字 = arr(i, 5)
If Not dic.exists(关键字) Then
dic(关键字) = Array(arr(i, 4), 关键字, arr(i, 6), arr(i, 7), arr(i, 2), arr(i, 9))
Else
t = dic(关键字)
If arr(i, 2) > t(4) Then
dic(关键字) = Array(arr(i, 4), 关键字, arr(i, 6), arr(i, 7), arr(i, 2), arr(i, 9))
End If
End If
End If
Next
Sheet2.Range("a2").Resize(dic.Count, 6) = Application.Rept(dic.items, 1)
End Sub
|