Sub MyDeleteRows()
Dim myLastRow As Long
Dim myRow As Long
Application.ScreenUpdating = False
' Find last row
myLastRow = Range("A1").SpecialCells(xlLastCell).Row
' Loop through all rows deleting rows where columns B or C equal 0 (including null values)
For myRow = myLastRow To 1 Step -1
If (Cells(myRow, "B") = 0) Or (Cells(myRow, "C") = 0) Then
Rows(myRow).EntireRow.Delete
End If
Next myRow
Application.ScreenUpdating = True
End Sub
myLastRow = Sheets("Sheet1").UsedRange.Rows.Count
'Loop through all rows deleting rows where columns B or C equal 0 or "".
For myRow = myLastRow To 1 Step -1
If Sheets("Sheet1").Cells(myRow, 2) = 0 Or Sheets("Sheet1").Cells(myRow, 3) = 0 Or Trim(Sheets("Sheet1").Cells(myRow, 2)) = "" Or Trim(Sheets("Sheet1").Cells(myRow, 3)) = "" Then
Sheets("Sheet1").Rows(myRow).EntireRow.Delete
End If
Next myRow
Sounds like there were some important details you may not have mentioned (where you are placing the code, whether or not it is being run from the same sheet, what is actually in the cells, are they derived from formulas or cut and pasted values, etc).Joe4, I couldn't get you code to work, but using your 'template' did the following which made it work.
[B]With Sheets("sheet1")
[/B] myLastRow = .UsedRange.Rows.Count
'Loop through all rows deleting rows where columns B or C equal 0 or "".
For myRow = myLastRow To 1 Step -1
If .Cells(myRow, 2) = 0 Or .Cells(myRow, 3) = 0 Or Trim(.Cells(myRow, 2)) = "" Or Trim(.Cells(myRow, 3)) = "" Then
.Rows(myRow).EntireRow.Delete
End If
Next myRow
[B]End With[/B]