Thread: deleting rows
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Andy Copeland Andy Copeland is offline
external usenet poster
 
Posts: 1
Default deleting rows

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