|
Sub 汇总()
Dim a, fName, wb As Workbook, arr
fName = Dir(ThisWorkbook.Path & "\*汇总*.xls", vbNormal)
a = Sheets(1).Cells(1, 255).End(xlToLeft).Column
Do
Set wb = Workbooks.Open(ThisWorkbook.Path & "\" & fName)
b = wb.Sheets(1).Cells(60000, 1).End(xlUp).Row - 2
arr = wb.Sheets(1).Cells(3, 1).Resize(b, a)
c = ThisWorkbook.Sheets(1).Cells(60000, 1).End(xlUp).Row + 1
If c = 2 Then c = c + 1
ThisWorkbook.Sheets(1).Cells(c, 1).Resize(b, a) = arr
fName = Dir
Erase arr
Loop Until fName = ""
End Sub |
|