Macro that deletes rows from cell containing End to end of data.

G

Guest

MS OS XP:
Excel 2000:

Need a macro that deletes all rows from the end of data up to a cell in
Colum A that contains the word End.

Example: If cell A(150) = “End†Then
Delete all rows from the end of data up to and including row 150.

Thanks in advanced,
 
G

Guest

Sub DeleteRowsAfterWordEnd()

Dim iRow As Long
Dim iCol As Long

iRow = 1
iCol = 1

While Cells(iRow, iCol) <> "End"
iRow = iRow + 1
If iRow > 65536 Then
Exit Sub
End If
Wend

Rows(Format(iRow, "0") & ":65536").Delete

End Sub
 
D

Don Guillett

try this simple ditty
sub delrows()
fr=columns(1).find("End").row
lr=cells(rows.count,"a").end(xlup).row
rows(fr & ":" & lr).delete
end sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top