|
Option Explicit
Sub test()
Dim ar, br, i&, j&, r&, ff, p$, strFileName
Application.ScreenUpdating = False
[A1].CurrentRegion.Offset(1).ClearContents
ReDim ar(1 To 10 ^ 4, 1 To 5)
p = ThisWorkbook.Path & "\"
For Each ff In CreateObject("Scripting.FileSystemObject").GetFolder(p).subfolders
strFileName = ff.Path & "\登记表.xlsx"
If Dir(strFileName) <> "" Then
With GetObject(strFileName)
br = .Sheets(1).[A1].CurrentRegion.Value
For i = 2 To UBound(br)
r = r + 1
ar(r, 1) = ff.Name
For j = 1 To UBound(br, 2)
ar(r, j + 1) = br(i, j)
Next j
Next i
.Close False
End With
End If
Next
[A2].Resize(r, UBound(ar, 2)) = ar
Application.ScreenUpdating = True
Beep
End Sub
|
评分
-
2
查看全部评分
-
|