|
发表于 2013-6-17 14:14
|
显示全部楼层
本楼为最佳答案
数组搞错了。- Sub 总数()
- Application.DisplayAlerts = False
- Application.ScreenUpdating = False
- Application.Calculation = xlCalculationManual
- Application.EnableEvents = False
-
- Dim arr
- Dim arrPos
- Dim i As Byte
-
- ThisWorkbook.Activate
- Sheets("1").Activate
- arrPos = Array(0, "al3", "al100", "al200", "al300", "al400")
- For i = 1 To 5
- With Workbooks.Open(ThisWorkbook.Path & "\book" & i & ".xls")
- arr = .Sheets(6).Range("A2:E95").Value
- .Close True
- End With
- ActiveSheet.Range(arrPos(i)).Resize(UBound(arr), UBound(arr, 2)).Value = arr
- Next
-
- Application.DisplayAlerts = True
- Application.ScreenUpdating = True
- Application.Calculation = xlCalculationAutomatic
- Application.EnableEvents = True
- MsgBox "OK"
-
- End Sub
复制代码 |
|