Thread
:
Do loop erroring
View Single Post
#
2
Posted to microsoft.public.excel.programming
JE McGimpsey
external usenet poster
Posts: 4,624
Do loop erroring
One way:
Dim rFound As Range
Set rFound = Cells.Find( _
What:="Jackson Fish", _
LookAt:=xlWhole)
Do Until rFound Is Nothing
rFound.EntireRow.Delete
Set rFound = Cells.FindNext
Loop
In article . com,
wrote:
I am a novice at writing macros and need what I hope is some easy to
obtain advice. I am trying to create a maco that will search for some
text and when it finds it will then delete the row where the text
appears and then continue searching for the same text. I have a simple
do loop that works, but I don't know how to make it stop when it
doesn't find the text. It errors when it can't find the text.
Here is the code:
Do
Cells.Find(What:="Jackson Fish", LookAt:=xlWhole).Activate
Range(Selection, Selection.EntireRow).Select
Selection.Delete Shift:=xlUp
Loop
Thanks in advance
Reply With Quote
JE McGimpsey
View Public Profile
Find all posts by JE McGimpsey