|
Option Explicit
Sub test()
Dim ar, i&, j&, strFileName$, strPath$, dic As Object, strKey$
Application.ScreenUpdating = False
Set dic = CreateObject("Scripting.Dictionary")
strPath = ThisWorkbook.Path & "\"
strFileName = Dir(strPath & "*.xlsx")
Do Until strFileName = ""
With GetObject(strPath & strFileName)
ar = .Worksheets(1).[A1].CurrentRegion.Value
For j = 2 To UBound(ar, 2)
For i = 2 To UBound(ar)
strKey = ar(i, 1) & "|" & ar(1, j)
dic(strKey) = ar(i, j)
Next i
Next j
.Close False
End With
strFileName = Dir
Loop
ar = [A1].CurrentRegion.Value
For j = 4 To UBound(ar, 2)
For i = 2 To UBound(ar)
strKey = ar(i, 1) & "|" & ar(1, j)
ar(i, j) = dic(strKey)
Next i
Next j
[A1].CurrentRegion.Value = ar
Set dic = Nothing
Application.ScreenUpdating = True
Beep
End Sub
|
评分
-
2
查看全部评分
-
|