Sub a1() '把A列包含在B列中的数据标出来,按钢瓶号
Dim Arr, i&, hS&, Dic As Object, Brr, tmPstr$
Set Dic = CreateObject("scripting.dictionary")
Dic.comparemode = vbTextCompare
With ActiveSheet
hS = .Cells(.Rows.Count, "E").End(3).Row
Arr = .[e1].Resize(hS, 4)
For i = 2 To UBound(Arr, 1)
Dic(Arr(i, 1) & "") = i
Next i
hS = .Cells(.Rows.Count, "A").End(3).Row
Brr = .[a2].Resize(hS - 1, 4)
For i = 1 To UBound(Brr, 1)
tmPstr = Brr(i, 1) & ""
If Dic.exists(tmPstr) Then
hS = Dic(tmPstr)
For j = 2 To UBound(Arr, 2)
Brr(i, j) = Arr(hS, j)
Next j
End If
Next i
.[a2].Resize(UBound(Brr, 1), UBound(Brr, 2)) = Brr
End With
End Sub
|