Always delete Rows from the bottom up and Columns from right to left.
Sub VBAX_SamT() Dim Rw As Long 'From the bottom row on the sheet, Column B, Press Ctrl+UpArrow. Get the Row number. Count backwards by 1 For Rw = (Cells(Rows.Count. "B").End(xlUp).Row to 3 Step -1 'Use only one of the below IFs If Sum(Range("B" & Rw & ":D" & Rw) = 0 Then If Sum(Range(Cells(Rw, 2), Cells(Rw, 4))) = 0 Then If Sum(Cells(Rw, "B").Resize(1, 3)) = 0 Then Rows(Rw).Delete End If Next Rw End Sub
I expect the student to do their homework and find all the errrors I leeve in.
Please take the time to read the Forum FAQ
remove the dot after Count
p45cal
Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.
And use only one of the three Ifs
I expect the student to do their homework and find all the errrors I leeve in.
Please take the time to read the Forum FAQ
Thanks for the super fast replies!
I changed a few minor things so it works for me now, it looks like this:
Sub VBAX_SamT()
Dim Rw As Long
For Rw = (Cells(Rows.Count, "B").End(xlUp).Row) To 3 Step -1
If Application.WorksheetFunction.Sum(Range(Cells(Rw, 2), Cells(Rw, 4))) = 0 Then
Rows(Rw).Delete
End If
Next Rw
End Sub