View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Robert Robert is offline
external usenet poster
 
Posts: 193
Default Deleting rows preceding

HI,
I have the following program that deletes the entire row when it finds the
characters "Inst" in Column A. Besides deleting just that row, I would also
like to be able to delete the three rows above it. Would I be able to change
this program and do it?
Thanks for your help.

_________________
Public Sub DeleteRows()

Dim RowNdx As Long
Dim LastRow As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For RowNdx = LastRow To 1 Step -1
If Cells(RowNdx, "A").Value = "Inst" Then
Rows(RowNdx).Delete
End If
Next RowNdx

End Sub
_________________