Thread: LOOPS IN MACROS
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default LOOPS IN MACROS

Hi Heather

See
http://www.rondebruin.nl/delete.htm

If you want to use Find try
http://www.rondebruin.nl/delete.htm#Find

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Heather O'Malley" wrote in message . ..
Hello

I'm trying to loop the below macro but having no luck.

I want in excel to find a certain word e.g. NOTNEEDED and delete whole line
then repeat until none left.

Any help gratefully accepted.

Range("A1").Select

Dim FoundCell As Range
With Worksheets("StockSheet")

Range("A1").Select

Set FoundCell = .Cells.Find(What:="NOTNEEDED", After:=ActiveCell, _
LookIn:=xlFormulas, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)

If FoundCell Is Nothing Then

Else

FoundCell.EntireRow.Delete
End If

End With