|
Sub 按钮1_Click()
Dim arr(1 To 5000, 1 To 2)
r = 0
Set fso = CreateObject("Scripting.FileSystemObject")
Application.ScreenUpdating = False
ActiveSheet.UsedRange.Offset(1).ClearContents
For Each f In fso.getfolder(ThisWorkbook.Path).Files
If InStr(f.Name, ThisWorkbook.Name) = 0 Then
With Workbooks.Open(f)
For Each sh In .Sheets
Set Rng = sh.UsedRange.Find("Total:", Lookat:=xlWhole)
If Not Rng Is Nothing Then
r = r + 1
arr(r, 2) = Rng.Offset(0, 10)
arr(r, 1) = f.Name
End If
Next sh
.Close False
End With
End If
Next f
If r >= 0 Then
[a2].Resize(r, 2) = arr
End If
Application.ScreenUpdating = True
End Sub
|
|