|
Sub 匹配()
Application.ScreenUpdating = False
Dim ar As Variant, br As Variant
Dim d As Object
Set d = CreateObject("scripting.dictionary")
With Sheets("设备与参数")
rs = .Cells(Rows.Count, 1).End(xlUp).Row
br = .Range("a1:i" & rs)
End With
For i = 2 To UBound(br)
If Trim(br(i, 2)) <> "" And Trim(br(i, 3)) <> "" And Trim(br(i, 5)) <> "" Then
zf = Trim(br(i, 2)) & "|" & Trim(br(i, 3)) & "|" & Trim(br(i, 5))
d(zf) = i
End If
Next i
With Sheets("sheet1")
r = .Cells(Rows.Count, 1).End(xlUp).Row
If r < 2 Then MsgBox "sheet1为空!": End
.Range("o2:q" & r) = Empty
ar = .Range("a1:q" & r)
For i = 2 To UBound(ar)
If Trim(ar(i, 6)) <> "" And Trim(ar(i, 9)) <> "" And Trim(ar(i, 10)) <> "" Then
zf = Trim(ar(i, 6)) & "|" & Trim(ar(i, 9)) & "|" & Trim(ar(i, 10))
xh = d(zf)
If xh <> "" Then
For j = 6 To 8
ar(i, j + 9) = br(xh, j)
Next j
End If
End If
Next i
.Range("a1:q" & r) = ar
End With
Set d = Nothing
Application.ScreenUpdating = True
MsgBox "ok!"
End Sub |
评分
-
2
查看全部评分
-
|