View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
William[_2_] William[_2_] is offline
external usenet poster
 
Posts: 227
Default Delete Rows where all cells = 0

Hi SL

Sub test()
Application.ScreenUpdating=False
Dim r As Range, rr As Range, c As Range
Set r = Range("A1:A655")
For Each c In r
If Application.CountIf(Range(c, c.Offset(0, 115)), 0) = 116 Then
If rr Is Nothing Then
Set rr = c
Else
Set rr = Union(rr, c)
End If
End If
Next c
If Not rr Is Nothing Then rr.EntireRow.Delete
Application.ScreenUpdating=True
End Sub

--
XL2002
Regards

William



"SL" wrote in message
...
| Hello
|
| I have a large worksheet - 655 rows & 116 columns. I need to be able to
| search each cell on each row & if all the cells are 0 then delete the row.
| Otherwise, leave the row on the worksheet.
|
| I need to be able to do this within a macro.
|
| Can anyone help??
|
| Thank You
|
| Sonya