View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Delete Rows where all cells = 0

Hi SL

Try this one for row 1 :655 0n the activesheet

Sub Example2()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 1
EndRow = 655
For Lrow = EndRow To StartRow Step -1

If Application.WorksheetFunction.CountIf(Range(.Cells (Lrow, "A"), _
.Cells(Lrow, "DL")), "0") = 116 Then .Rows(Lrow).Delete

Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"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