Sub AAA()
Dim Sh1 As Worksheet
Dim Sh2 As Worksheet
Set Sh1 = Workbooks("1.XLS").Sheets(1)
Set Sh2 = Workbooks("2.XLS").Sheets(1)
Sh1.Range(Sh1.[A1], Sh1.Range("A1").End(xlDown)).Copy Sh2.[A1]
Sh1.Range(Sh1.[A65536].End(xlUp), Sh1.[A65536].End(xlUp).End(xlUp)).Copy Sh2.[B1]
End Sub
随便放哪个工作簿吧。但是,两个工作簿都要打开。当然你也可以加上打开工作簿的代码。
Sub test()
Dim row1 As Integer
Dim row2 As Integer
row1 = Sheets("1").Cells(1, 1).End(xlDown).Row
row2 = Sheets("1").Cells(65536, 1).End(xlUp).Row
Sheets("1").Range("A1:A" & row1).Copy Sheets("2").Cells(1, 1)
Sheets("1").Range("A" & row1 + 2 & ":A" & row2).Copy Sheets("2").Cells(1, 2)
End Sub
已经通过验证。
最好有附件啊,能上附件吗