Thread: deleting rows
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Donald Lloyd Donald Lloyd is offline
external usenet poster
 
Posts: 30
Default deleting rows

Use

If cell.Value = 0 Then cell.EntireRow.Delete

regards,

Don Lloyd
--

"Andy Copeland" wrote in message
...
Hi,
I am trying to delete all the rows where a zero value is in
column C. This is what I came up with but it deletes everything in the
column and none of the rows. I appreciate any help. I am using Excel

2000.
Thanks.

Sub DeleteRows()
If TypeName(Selection) < "Range" Then Exit Sub
On Error Resume Next
For Each Cell In Selection
If Cell.Value = 0 Then Row.Select = True Else Row.Select False
If Selection = True Then Selection.Delete
Next Cell
End Sub