Forum Discussion
VersiteRL
Oct 12, 2022Copper Contributor
VBA copy range to another sheet/file + new rows (from the same range) copy to new row below
Hello, I've tried a number of ways on the Internet, but none of them have worked. Please I would need some advice, how to copy one row to another sheet (preferably to another excel file) and copy...
- Oct 12, 2022
Sub Copy() Dim l As Long l = Worksheets("Sheet2").Range("A1").End(xlDown).Row Worksheets("Sheet1").Range("A39:S39").Copy _ Destination:=Worksheets("Sheet2").Cells(l, 1).Offset(1, 0) End Sub
You can try this code. In sheet2 i've added values "x" in cells A1, A2 and A3 in order to make the End(xlDown) command return the expected row number.
OliverScheurich
Oct 12, 2022Gold Contributor
Sub Copy()
Dim l As Long
l = Worksheets("Sheet2").Range("A1").End(xlDown).Row
Worksheets("Sheet1").Range("A39:S39").Copy _
Destination:=Worksheets("Sheet2").Cells(l, 1).Offset(1, 0)
End Sub
You can try this code. In sheet2 i've added values "x" in cells A1, A2 and A3 in order to make the End(xlDown) command return the expected row number.
VersiteRL
Oct 12, 2022Copper Contributor
I don't know how can I add a file to the thread. (I'm getting an error that the file is not supported and I'm using yours.) - send you your edited file with formulas to the dm's
Thank you in advance