|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub yy()
- Dim fso, folder, myPath$, Filename$, wb1 As Workbook, m&, Arr
- Dim Sht1 As Worksheet, i&, nm1$, wbnm$, sh As Worksheet, Myr&, Myc&
- Application.ScreenUpdating = False
- r = 0
- myPath = ThisWorkbook.Path & ""
- Set wb1 = ThisWorkbook
- a = InStr(wb1.Name, ".")
- wbnm = Left(wb1.Name, a - 1)
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set folder = fso.GetFolder(myPath)
- strTmp = GetFileFolderList(folder)
- For i = 1 To r
- Filename = Arr1(i)
- nm1 = Split(Mid(Filename, InStrRev(Filename, "") + 1), ".")(0)
- If InStr(nm1, wbnm) Or Left(nm1, 1) = "$" Then GoTo 200
- Workbooks.Open Filename
- Dim wb As Workbook
- Set wb = ActiveWorkbook
- For Each sh In wb.Sheets
- Myr = sh.[b65536].End(xlUp).Row
- Myc = sh.[iv2].End(xlToLeft).Column
- nm = sh.Name
- If Myr > 2 Then
- Arr = sh.Range("a3", sh.Cells(Myr, Myc))
- With wb1.Sheets(nm)
- m = .[b65536].End(xlUp).Row + 1
- .Cells(m, 1).Resize(UBound(Arr), UBound(Arr, 2)) = Arr
- End With
- End If
- Next
- wb.Close savechanges:=False
- Set wb = Nothing
- 200:
- Next
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|