|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 常规法()
Dim Fso As Object, File As Object, m&, n&, arr, brr(1 To 100000, 0 To 3), i&, j&
Application.ScreenUpdating = False
Set Fso = CreateObject("Scripting.FileSystemObject")
For Each File In Fso.GetFolder(CreateObject("scripting.filesystemobject").GetFolder(ThisWorkbook.Path).ParentFolder.Path & "\张庄乡八里村 旧表").Files
If File.Name Like "*.xls*" Then
n = n + 1
With GetObject(File)
arr = .Sheets("信息总表").Range("B2:D13")
.Close 0
End With
brr(m + 1, 0) = n
For i = 1 To UBound(arr)
If Len(arr(i, 1)) = 0 Then Exit For
m = m + 1
For j = 1 To UBound(arr, 2)
brr(m, j) = arr(i, j)
Next
Next
End If
Next
ActiveSheet.UsedRange.Offset(2).ClearContents
Range("A3").Resize(m, 4) = brr
Set Fso = Nothing
Application.ScreenUpdating = True
End Sub
|
|