ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy cell row (https://www.excelbanter.com/excel-programming/317151-copy-cell-row.html)

Philmer

Copy cell row
 

How can I modify this so that it check for all the rows that have a 40
in the last cell and will copy all the rows that have 40 in the last
cell to a new work sheet and also delete the rows after it copies them
( delete just the ones that have 40 in the last cell that it copied)


Sub CopyLastRow()
Dim LastRow As Object
Set LastRow = Sheets("Sheet2").Range("A65536").End(xlUp)

If Sheet1.Cells.SpecialCells(xlCellTypeLastCell) = 40 Then
Sheet1.Cells.SpecialCells(xlCellTypeLastCell).Enti reRow.Copy
LastRow.Offset(1, 0)
Sheet2.Cells.SpecialCells(xlCellTypeLastCell).Enti reRow.Paste
End If

End Sub


--
Philmer
------------------------------------------------------------------------
Philmer's Profile: http://www.excelforum.com/member.php...o&userid=16577
View this thread: http://www.excelforum.com/showthread...hreadid=314445



All times are GMT +1. The time now is 04:44 AM.

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