Thread: Delete rows
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Delete rows

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

--
Regards
Frank Kabel
Frankfurt, Germany


fl wrote:
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?