|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub Macro1()
Dim arr, brr(1 To 60000, 1 To 4), d As Object, MyPath$, MyName$, i&, j&, m&
Set d = CreateObject("scripting.dictionary")
arr = Sheets("姓名").[a1].CurrentRegion
For i = 1 To UBound(arr)
d(arr(i, 1)) = ""
Next
MyPath = ThisWorkbook.Path & "\"
MyName = Dir(MyPath & "*.xls")
Application.ScreenUpdating = False
[a1].CurrentRegion.Offset(1).ClearContents
Do While MyName <> ""
If MyName <> ThisWorkbook.Name Then
With GetObject(MyPath & MyName)
arr = .Sheets(1).[a1].CurrentRegion
.Close False
End With
For i = 2 To UBound(arr)
If d.Exists(arr(i, 3)) Then
m = m + 1
For j = 1 To 4
brr(m, j) = arr(i, j)
Next
End If
Next
End If
MyName = Dir
Loop
[a2].Resize(m, 4) = brr
Application.ScreenUpdating = True
End Sub
[ 本帖最后由 zhaogang1960 于 2011-3-27 15:31 编辑 ] |
|