|
Sub tt()
Dim arrOrder, dic As Object, arrData, i As Long, n As Integer
Dim brr()
n = 0
Set dic = CreateObject("scripting.dictionary")
arrOrder = Sheet1.Range("a1").CurrentRegion.Value
arrData = Sheet2.Range("a1").CurrentRegion.Value
ReDim brr(1 To UBound(arrData), 1 To 4)
For i = 2 To UBound(arrOrder)
dic(arrOrder(i, 1)) = ""
Next i
For i = 2 To UBound(arrData)
If arrData(i, 1) = "" Then arrData(i, 1) = arrData(i - 1, 1)
Next i
For i = 2 To UBound(arrData)
If dic.exists(arrData(i, 1)) = True Then
n = n + 1
brr(n, 1) = arrData(i, 1)
brr(n, 2) = arrData(i, 2)
brr(n, 3) = arrData(i, 3)
brr(n, 4) = arrData(i, 4)
End If
Next i
For i = n To 2 Step -1
If i = 1 Then Exit For
If brr(i, 1) = brr(i - 1, 1) Then brr(i, 1) = ""
Next i
With Sheet1
.Range("B:B").NumberFormatLocal = "@"
.Range("a23").Resize(n, 4) = brr
End With
End Sub
|
评分
-
1
查看全部评分
-
|