abdelfattah
Well-known Member
- Joined
- May 3, 2019
- Messages
- 1,429
- Office Version
- 2019
- 2010
- Platform
- Windows
hi
i try ignoring empty rows when i copy the last ten rows from sheet1 to sheet2 but it doesn't success
any idea to do that
thanks
i try ignoring empty rows when i copy the last ten rows from sheet1 to sheet2 but it doesn't success
any idea to do that
VBA Code:
Sub CopyLines()
Dim LastRow, LastRow1 As Long
LastRow = Sheets("Sheet1").Cells(Rows.Count, "b").End(xlUp).Row
Sheets("Sheet1").SpecialCells(xlCellTypeBlanks).Delete xlUp
Sheets("Sheet1").Range("A" & LastRow - 9 & ":B" & LastRow).Copy Sheets("Sheet2").Range("h11")
End Sub