abdelfattah
Well-known Member
- Joined
- May 3, 2019
- Messages
- 1,429
- Office Version
- 2019
- 2010
- Platform
- Windows
hi, expert
i try designing a simple macro to copy the last ten rows from sheet to another in sheet1 contains data from a2:b sheet2 contains data from h11:i but i failed
i would thankfully if anybody provide me the solution
this is my try
thanks
i try designing a simple macro to copy the last ten rows from sheet to another in sheet1 contains data from a2:b sheet2 contains data from h11:i but i failed
i would thankfully if anybody provide me the solution
this is my try
VBA Code:
Sub CopyLines()
Dim LastRow As Long
LastRow = Sheets("Sheet1").Cells(Rows.Count, "b").End(xlUp).Row
Sheets("Sheet1").Range("b" & LastRow - 10 & ":b" & LastRow & "a" & LastRow - 10 & ":a" & LastRow).Copy Sheets("Sheet2").Range("h11")
End Sub