|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub qq()
- Dim mypath$, myname$, wb As Workbook, ws As Worksheet, r%, c%, i%
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Application.AskToUpdateLinks = False
- ThisWorkbook.Sheets(1).[a1].CurrentRegion.Offset(1).ClearContents
- mypath = ThisWorkbook.Path & ""
- myname = Dir(mypath & "*.xls*")
- Do While myname <> ""
- If myname <> ThisWorkbook.Name Then
- Set wb = GetObject(mypath & myname)
- With wb
- Set ws = .Sheets(1)
- With ws
- r = .Cells(Rows.Count, 1).End(xlUp).Row
- c = .Cells(1, Columns.Count).End(1).Column
- i = ThisWorkbook.Sheets(1).Cells(Rows.Count, 1).End(xlUp).Row + 1
- .Range(.Cells(2, 1), .Cells(r, c)).Copy ThisWorkbook.Sheets(1).Cells(i, 1)
- End With
- .Close False
- End With
- End If
- myname = Dir
- Loop
- Application.ScreenUpdating = True
- Application.DisplayAlerts = True
- Application.AskToUpdateLinks = True
- End Sub
复制代码 |
|