|
学习楼上大侠的,练练题吧Sub text()
Dim fso
Dim x, y, k
Dim arr, brr(1 To 100000, 1 To 32)
Set fso = CreateObject("scripting.filesystemobject")
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each f In fso.getfolder(ThisWorkbook.Path).Files
If InStr(f.Name, ThisWorkbook.Name) = 0 Then
With Workbooks.Open(f)
arr = .Sheets(1).UsedRange
.Close False
End With
For x = 2 To UBound(arr)
If InStr(arr(x, 1), "Average") > 0 Then
k = k + 1
brr(k, 1) = arr(2, 1)
For y = 2 To UBound(arr, 2)
brr(k, y) = arr(x, y)
Next
Exit For
End If
Next
End If
Next
Sheets(1).Range("a6:af100000").ClearContents
Sheets(1).[a6].Resize(k, UBound(brr, 2)) = brr
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
|
|