I have a simple macro which deletes all lines in a sheet containing a particular variable, "Hobbs" in the code below. I created the macro by recording a 'find'. The macro works fine in that it finds and deletes all the lines but at the end, when it can't find another occurrence of the variable, it comes up with the error message: Run-time error '91'. I just end the macro, but I would like to include this in a larger macro but can't with the error.
Sue
Code:
Sub Hobbs ()
FindAgain:
' Find row with Hobbs
Cells.Find(What:="hobbs", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
' Select the row and then delete it
ActiveCell.Rows("1:1").EntireRow.Select
Selection.Delete Shift:=xlUp
GoTo FindAgain
End Sub
Sue