请测试。。。
- Sub test()
- p = ThisWorkbook.Path & ""
- f = Dir(p & "*.xlsx")
- Dim brr(1 To 10000, 1 To 11)
- arr = Split("D6,F6,I6,D8,F8,I8,I10", ",")
- crr = Array(3, 4, 7, 9)
- Do While f <> ""
- If f <> ThisWorkbook.Name Then
- Set wb = Workbooks.Open(p & f)
- With wb.Sheets(1)
- i = 13
- s = .Cells(i, 3)
- Do While .Cells(i, 3) <> ""
- n = n + 1
- For j = 0 To 6
- brr(n, j + 1) = .Range(arr(j))
- Next
- For j = 0 To 3
- brr(n, j + 8) = .Cells(i, crr(j))
- Next
- i = i + 1
- Loop
- End With
- wb.Close
- End If
- f = Dir
- Loop
- [a2].Resize(n, 11) = brr
- End Sub
复制代码 |