|
Sub 最小值与供应商()
Set d最低价 = CreateObject("scripting.dictionary")
Set d供应商 = CreateObject("scripting.dictionary")
arr = Sheet1.Range("a1").CurrentRegion
For x = 3 To UBound(arr)
d最低价(arr(x, 1)) = 100000000
For y = 7 To 11
If d最低价(arr(x, 1)) > arr(x, y) Then
d最低价(arr(x, 1)) = arr(x, y)
End If
Next
arr(x, 13) = d最低价(arr(x, 1))
Next
For x = 3 To UBound(arr)
For y = 7 To 11
If arr(x, y) = d最低价(arr(x, 1)) Then
d供应商(arr(x, 1)) = d供应商(arr(x, 1)) & " " & arr(2, y)
End If
Next
arr(x, 12) = d供应商(arr(x, 1))
Next
Sheet1.Range("a1").CurrentRegion = arr
MsgBox "ok"
End Sub
|
|