Delete rows

  • Thread starter Thread starter fl
  • Start date Start date
F

fl

If the cell value = "ABC" on column A, then I need to delete that row
and the next two rows. What is the formula to do that?
 
Hi
try the following macro:
Sub delete_rows()
Dim lastrow As Long
Dim row_index As Long
Application.ScreenUpdating = False
lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
For row_index = lastrow - 1 To 1 Step -1
If Cells(row_index, 1).Value = "ABC" then
cells(row_index,1).resize(3,1).entirerow.delete
End If
Next
Application.ScreenUpdating = True
End Sub
 
Back
Top