View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Help on cleaning / speeding up code

Chris,
See if this is any faster.
Jim Cone
San Francisco, USA

'---------------------------
Sub Delete0ValueRows()
Dim mRows As Long
Dim ris As Long

mRows = 1000
ris = mRows
Application.ScreenUpdating = False
Do While ris 0
If Application.Sum(Range(Cells(ris, 2), Cells(ris, 7))) = 0 Then
Cells(ris, 2).EntireRow.Delete
End If
ris = ris - 1
Loop
'Call DeleteUnused '?
Application.ScreenUpdating = True
End Sub
'-----------------------

"Chris Salcedo"
wrote in message
oups.com...
Hi guys,

- snip -

I have another piece of ugly code that also works but is slow.
This checks to see if all values of row x columns B-G are 0 and if so
delete the entire row.

Sub Delete0ValueRows()
ris = mrows
Application.ScreenUpdating = False
Do While ris < 0
If Range("B" & ris).Value = "0" And Range("C" & ris).Value =
"0" And _
Range("D" & ris).Value = "0" And Range("E" & ris).Value = "0"
And _
Range("F" & ris).Value = "0" And Range("G" & ris).Value = "0"
Then
Range("A" & ris).EntireRow.Delete
End If
ris = ris - 1
Loop
Call DeleteUnused
Application.ScreenUpdating = True
End Sub
Thanks for the help...