|
Sub 按钮1_Click()
Set d = CreateObject("scripting.dictionary")
arr = Sheets(1).[b1].CurrentRegion
For j = 2 To UBound(arr)
d(arr(j, 1)) = ""
Next j
arr = Sheets(2).[a1].CurrentRegion
brr = Sheets(2).[a1].CurrentRegion
For j = 2 To UBound(arr)
If d.exists(arr(j, 2)) Then d(arr(j, 2)) = d(arr(j, 2)) & "," & j
Next j
r = 1
For Each k In d.keys
If Len(d(k)) = 0 Then
r = r + 1
brr(r, 1) = "无"
brr(r, 2) = k
brr(r, 3) = "无"
Else
crr = Split(d(k), ",")
For j = 1 To UBound(crr)
r = r + 1
For i = 1 To UBound(arr, 2)
brr(r, i) = arr(Val(crr(j)), i)
Next i
Next j
End If
Next k
Sheets(3).[g1].Resize(r, 3) = brr
End Sub
|
|