|
Sub 合并()
Dim wb As Workbook
Set wb = Workbooks.Open("E:\A.xls")
Dim x, y, z, d As Integer
For x = 1 To wb.Sheets.Count
y = wb.Sheets(x).Range("a1234").End(xlUp).Row
z = wb.Sheets(x).Cells(1, 10).End(xlToLeft).Column
If x = 1 Then
wb.Sheets(x).Range(Cells(1, 1), Cells(y, z)).Copy Range("a1")
Else:
d = ThisWorkbook.Sheets(3).Range("a1234").End(xlUp).Row + 1
wb.Sheets(x).Range(Cells(2, 2), Cells(y, z)).Copy Range("A" & d)
End If
Next x
wb.Close True
End Sub
'不知道哪里出错了=。=
|
|