|
- Sub qs()
- Dim arr, wb As Workbook, xb As Workbook, dic As Object, p
- Set dic = CreateObject("scripting.dictionary")
- p = ThisWorkbook.Path & "\999\数据库.xlsx"
- With GetObject(p)
- arr = .Sheets(1).UsedRange.Value
- .Close False
- End With
- For i = 3 To UBound(arr)
- If Not VBA.IsError(arr(i, 2)) Then
- s = arr(i, 2) & "|" & arr(i, 6)
- dic(s) = arr(i, 1)
- End If
- Next
- Erase arr
- With Sheet1
- r = .Cells(Rows.Count, "d").End(3).Row
- brr = .Range("d3").Resize(r, 2).Value
- ReDim crr(1 To r, 1 To 1)
- For i = 1 To UBound(brr)
- s = brr(i, 1) & "|" & brr(i, 2)
- If dic.exists(s) Then
- crr(i, 1) = dic(s)
- End If
- Next
- .Range("c3").Resize(10000, 1).ClearContents
- .Range("c3").Resize(r, 1) = crr
- End With
- End Sub
复制代码 |
|