|
Sub TEST()
Dim strFileName$, strPath$, wkb As Workbook
Dim arr, i&, j&, t#
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
t = Timer
[A1].CurrentRegion.Offset(1, 1).Clear
[A1].CurrentRegion.Offset(1, 1).NumberFormatLocal = "0.00000000000"
arr = [A1].CurrentRegion
For i = 2 To UBound(arr): dic(arr(i, 1)) = i: Next i
For i = 2 To UBound(arr, 2): dic(arr(1, i)) = i: Next i
strPath = ThisWorkbook.Path & "\"
For i = 2 To UBound(arr, 2)
strFileName = Dir(strPath & "*" & arr(1, i) & "*")
Set wkb = GetObject(strPath & strFileName)
With wkb
brr = .Sheets(1).[A1].CurrentRegion
For j = 2 To UBound(brr)
If dic.exists(brr(j, 1)) Then
arr(dic(brr(j, 1)), dic(arr(1, i))) = brr(j, 2)
End If
Next j
End With
wkb.Close False
Next i
[A1].CurrentRegion = arr
Set wkb = Nothing
Application.ScreenUpdating = True
MsgBox "执行完毕!_用时: " & Format(Timer - t, "0.00") & " 秒", 64
Beep
End Sub
|
评分
-
1
查看全部评分
-
|