|
ub 查找()
Dim ar As Variant, cr As Variant
Dim i As Long, r As Long, rs As Long
Dim d As Object
Set d = CreateObject("scripting.dictionary")
With Sheets("sheet1")
rs = .Cells(Rows.Count, 1).End(xlUp).Row
.Range("b2:b" & rs) = Empty
ar = .Range("a1:b" & rs)
For i = 2 To UBound(ar)
If Trim(ar(i, 1)) <> "" Then
zd = Trim(ar(i, 1)) & ".dwg"
d(zd) = i
End If
Next i
f = Dir(ThisWorkbook.Path & "\图集\*.dwg")
Do While f <> ""
xh = d(f)
If xh <> "" Then
m = m + 1
FileCopy ThisWorkbook.Path & "\图集\" & f, ThisWorkbook.Path & "\录入图集\" & f
ar(xh, 2) = "找到"
End If
f = dor
Loop
.Range("a1:b" & rs) = ar
End With
MsgBox "找到了" & m & "个"
End Sub
|
|