ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Modify to delete row (https://www.excelbanter.com/excel-programming/325486-modify-delete-row.html)

Pat

Modify to delete row
 
LastRow = Cells(Rows.Count, "AJ").End(xlUp).Row
For i = LastRow To 1 Step -1
If Cells(i, "AJ").Value = "1" Then

Cells(i, 1).Range("B1").ClearContents

End If
Next


The above will clear content only, what change is needed to delete the
entire row.

Pat



Bob Phillips[_6_]

Modify to delete row
 
Hi Pat,

LastRow = Cells(Rows.Count, "AJ").End(xlUp).Row
For i = LastRow To 1 Step -1
If Cells(i, "AJ").Value = "1" Then
Cells(i, 1).Range("B1").Entirerow.Delete
End If
Next


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Pat" wrote in message
...
LastRow = Cells(Rows.Count, "AJ").End(xlUp).Row
For i = LastRow To 1 Step -1
If Cells(i, "AJ").Value = "1" Then

Cells(i, 1).Range("B1").ClearContents

End If
Next


The above will clear content only, what change is needed to delete the
entire row.

Pat






All times are GMT +1. The time now is 06:40 AM.

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