|
楼主 |
发表于 2010-1-3 17:54
|
显示全部楼层
回复 26楼 3abc 的帖子
请测试:
Sub Macro1()
Dim myPath$, myFile$, wb As Workbook, sh As Worksheet, m&
Set wb = ThisWorkbook
myPath = ThisWorkbook.Path & "\分表\"
myFile = Dir(myPath & "*.xls")
Application.ScreenUpdating = False
Do While myFile <> ""
m = m + 1
With GetObject(myPath & myFile)
For Each sh In .Sheets
wb.Sheets(sh.Name).Cells(1, m + 3).Resize(77).Value = sh.Range("D1:D77").Value
wb.Sheets(sh.Name).Cells(2, m + 3) = m
Next
.Close False
End With
myFile = Dir
Loop
Application.ScreenUpdating = True
MsgBox "ok"
End Sub |
|