ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro (https://www.excelbanter.com/excel-programming/355470-macro.html)

Antonov

macro
 
hello, I would like to know if it is possible to create a macro to select
the LAST WRITTEN row of a worksheet and then paste it at the end of another
sheet
thanks for any help



Ardus Petus

macro
 
Sub MoveIt()
Dim srcRng As Range
Dim destRng As Range
Set srcRng = Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).EntireRow
Set destRng = Worksheets("Sheet2").Cells(Rows.Count,
"A").End(xlUp).Offset(1, 0)
srcRng.Copy destRng
End Sub

Warning: fails if column A in either Sheet1 or Sheet2 is empty

HTH
--
AP

"antonov" a écrit dans le message de
.. .
hello, I would like to know if it is possible to create a macro to select
the LAST WRITTEN row of a worksheet and then paste it at the end of

another
sheet
thanks for any help







All times are GMT +1. The time now is 03:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com