|
还是很慢,不会改啦- Sub ww()
- Cells.Clear
- Dim mapath$, maname$, wb As Workbook, ws As Worksheet, s$, r%
- Dim t, arr, brr(), n%, i%, j%, x%
- t = Timer
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- mapath = ThisWorkbook.Path & ""
- maname = Dir(mapath & "*初审*.xlsx")
- Do While maname <> ""
- If maname <> ThisWorkbook.Name Then
- 'r = r + 2
- Set wb = Workbooks.Open(mapath & maname)
- For Each ws In wb.Sheets
- If ws.Name = "成本单(表3)" Then
- arr = ws.[a1].CurrentRegion '.Copy ThisWorkbook.Sheets("sheet1").Range("a" & r)
- For i = 1 To UBound(arr)
- n = n + 1
- ReDim Preserve brr(1 To 31, 1 To n)
- For j = 1 To 31
- brr(j, n) = arr(i, j)
- Next
- Next
- Exit For
- End If
- Next
- End If
- wb.Close
- maname = Dir
- 'r = Cells(Rows.Count, 1).End(xlUp).Row
- Loop
- [a1].Resize(n, 31) = Application.Transpose(brr)
- MsgBox "程序用时" & Format(Timer - t, "0.00") & "秒"
- End Sub
复制代码 |
|