|
发表于 2014-3-28 12:47
|
显示全部楼层
本楼为最佳答案
- Sub Macro1()
- Dim wb As Workbook, mypath$, wj$, n&, rng As Range
- mypath = ThisWorkbook.Path & "\数据"
- Application.ScreenUpdating = False
- Sheet2.UsedRange.Clear
- wj = Dir(mypath & "*.xls")
- n = 1
- Do While wj <> ""
- Set wb = GetObject(mypath & wj)
- Set rng = wb.Sheets(1).Range("a1").CurrentRegion
- rng.Copy Sheet2.Cells(1, n)
- n = Sheet2.Cells(1, Columns.Count).End(xlToLeft).Column + 1
- Sheet2.Cells(1, n - 1).Resize(rng.Rows.Count, 1).Interior.ColorIndex = 6
- wb.Close 0
- wj = Dir
- Loop
- Sheet2.Activate
- Application.ScreenUpdating = True
- End Sub
复制代码 |
评分
-
查看全部评分
|