I want to copy all rows below Row 3 in sheet2 and paste them below the last row in sheet 1. I don't want to use 'Activesheet" like I have below. Is there another way to accomplish this?
(This doesn't work):
Rows("3:3").Select
Range(Selection, Selection.End(x1Down)).Select
Selection.Copy
Sheets("sheet1").Select
Range(Selection, Selection.End(x1Down)).Select
ActiveSheet.Paste
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.