View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Delete all rows with designated word

Hi

For r = .UsedRange.Rows.Count To 1 Step -1

This will find the last row in the UsedRange and will loop from the bottem up to row 1

r = the row number in the loop
We use Cells(row,column) to see if the cell in column A have the text "Find" in it and delete the row
if the text is "Find"
If .Cells(r, "A").Value = "Find" Then .Rows(r).Delete


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"PHILLY" wrote in message ...
Pure genius! Now, can you explain it to the humans?



-----Original Message-----
Try this

It will look for "Find" in the A column in Worksheets

("Sheet1")

Sub Test()
Dim r As Long
Application.ScreenUpdating = False
With Worksheets("Sheet1")
For r = .UsedRange.Rows.Count To 1 Step -1
If .Cells(r, "A").Value = "Find" Then .Rows

(r).Delete
Next
End With
Application.ScreenUpdating = True
End Sub



--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"PHILLY" wrote in

message ...
I'm looking for code that looks in one specific column

for
a certain word ("delete") and deletes all those rows in
which it appears. I'm trying to use "Find" so that I can
delete them all at once rather than have it cycle

through
each row. I'm sure there is a better way.........


Thanks!



.