View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.newusers
Alan Alan is offline
external usenet poster
 
Posts: 492
Default Adding a loop to conditional delete code

Sub DelOver16()
Dim Rng, Cell
Set Rng = Range("A1:A10000")
For Each Cell In Rng
If Cell.Value = 16 Then Cell.EntireRow.Delete
Next
End Sub

Regards,
Alan.
"maw via OfficeKB.com" <u12713@uwe wrote in message
news:64cdc9dbc43e6@uwe...
Hello all,

I have the following code:

Sub DelOver16()

If ActiveCell.Value = 16 Then ActiveCell.EntireRow.Delete

End Sub

What I need to do is have the code loop through cells F2:F10000 and delete
entire rows that have a value of =16.

How would I do that?

Many thanks in advance

Mark

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...l-new/200608/1