- Sub test() 'by feiren228
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Dim arr, brr, crr(1 To 100000, 1 To 14), n&, p$, nm$
- p = ThisWorkbook.Path & ""
- nm = Dir(p & "*.xls")
- Do While nm <> ""
- If nm <> ThisWorkbook.Name Then
- With GetObject(p & nm)
- n = n + 1
- arr = .Sheets("正面").Range("A1:V6")
- brr = .Sheets("反面").Range("A1:D5")
- .Close 0
- crr(n, 1) = arr(2, 3): crr(n, 2) = arr(2, 7): crr(n, 3) = arr(2, 17)
- crr(n, 4) = arr(4, 3): crr(n, 5) = arr(4, 7): crr(n, 6) = arr(4, 17)
- crr(n, 7) = arr(5, 3): crr(n, 8) = arr(5, 7): crr(n, 9) = arr(5, 17)
- crr(n, 10) = arr(6, 3): crr(n, 11) = arr(6, 12)
- crr(n, 12) = brr(2, 4): crr(n, 13) = brr(3, 4): crr(n, 14) = brr(4, 4)
- End With
- End If
- nm = Dir
- Loop
- With Sheets("汇总")
- .[a2].Resize(6000, 14).ClearContents
- .[a2].Resize(n, 14) = crr
- .UsedRange.EntireRow.AutoFit
- .UsedRange.EntireColumn.AutoFit
- End With
- Application.DisplayAlerts = True
- Application.ScreenUpdating = True
- End Sub
复制代码 |