|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub test()
- Dim r%, i%
- Dim arr, brr(1 To 10000, 1 To 11)
- Dim wb As Workbook
- Dim ws As Worksheet
- Dim mypath$, myname$
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- mypath = ThisWorkbook.Path & ""
- myname = Dir(mypath & "*.xls")
- m = 0
- Do While myname <> ""
- If myname <> ThisWorkbook.Name Then
- Set wb = GetObject(mypath & myname)
- wjm = Split(myname, ".")(0)
- With wb
- With .Worksheets(1)
- r = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("a5:q" & r)
- For i = 6 To UBound(arr)
- m = m + 1
- brr(m, 1) = arr(i, 1)
- brr(m, 2) = wjm
- brr(m, 3) = arr(1, 3)
- brr(m, 4) = arr(3, 3)
- brr(m, 5) = arr(i, 2)
- brr(m, 6) = arr(i, 4)
- brr(m, 7) = arr(i, 6)
- brr(m, 8) = arr(i, 10)
- brr(m, 9) = arr(i, 13)
- brr(m, 10) = arr(i, 15)
- brr(m, 11) = arr(i, 17)
- Next
- End With
- .Close False
- End With
- End If
- myname = Dir
- Loop
- With Worksheets("sheet1")
- .Range("a3:k" & .Rows.Count).ClearContents
- .Range("a3").Resize(m, UBound(brr, 2)) = brr
- End With
- End Sub
复制代码 |
评分
-
3
查看全部评分
-
|