View Single Post
  #6   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

Use

With ActiveSheet
Instead of
With Worksheets("Sheet1")



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



"PHILLY" wrote in message ...
One more question: How can I substitute the active
worksheet name for "Sheet 1" (the worksheet name will be
different each time)?

TIA

-----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!



.