|
楼主 |
发表于 2016-11-19 16:20
|
显示全部楼层
Sub 第1次采购价()
Dim i&, j&
m = [a65536].End(3).Row + 1
arr = Range("a2:c" & m)
brr = Application.Index(arr, , 2)
ReDim crr(1 To UBound(arr), 1 To 2)
For i = 1 To UBound(arr) - 1
If brr(i, 1) <> "" Then x = x + 1: crr(x, 1) = brr(i, 1)
For j = i + 1 To UBound(arr)
If brr(j, 1) = brr(i, 1) Then brr(j, 1) = ""
Next
Next
For i = 1 To x
For j = 1 To UBound(arr)
If arr(j, 2) = crr(i, 1) Then
crr(i, 2) = arr(j, 3)
Exit For
End If
Next
Next
[e2].Resize(x, 2) = crr
End Sub
Sub 第2次采购价()
Dim i&, j&
m = [a65536].End(3).Row + 1
arr = Range("a2:c" & m)
brr = Application.Index(arr, , 2)
ReDim crr(1 To UBound(arr), 1 To 2)
For i = 1 To UBound(arr) - 1
If brr(i, 1) <> "" Then x = x + 1: crr(x, 1) = brr(i, 1)
For j = i + 1 To UBound(arr)
If brr(j, 1) = brr(i, 1) Then brr(j, 1) = ""
Next
Next
For i = 1 To x
For j = UBound(arr) To 1 Step -1
If arr(j, 2) = crr(i, 1) Then
crr(i, 2) = arr(j, 3)
Exit For
End If
Next
Next
[i2].Resize(x, 2) = crr
End Sub
|
|