我想复制sheet2中第3行下面的所有行,然后将它们粘贴到表单1中的最后一行下面。我不想像我在下面那样使用'Activesheet'。还有其他方法可以实现吗?
(这不起作用):
Rows("3:3").Select
Range(Selection, Selection.End(x1Down)).Select
Selection.Copy
Sheets("sheet1").Select
Range(Selection, Selection.End(x1Down)).Select
ActiveSheet.Paste
答案 0 :(得分:0)
Dim ws as Worksheet
Set ws = Worksheets("mySheet") 'change name as needed
With ws
'assumes data is in a "table" format with all data rows in column A and data columns in row 1
Dim lRow as Long, lCol as Long
lRow = .Range("A" & .Rows.Count).End(xlUp).Row
lCol = .Cells(1,.Columns.Count).End(xlToLeft).Column
.Range(.Range("A4"),.Cells(lRow,lCol)).Copy _
Worksheets("Sheet1").Range("A" & .Rows.Count).End(xlUp).Offset(1)
End With