lundi 25 septembre 2017

Excel VBA - If the sum of a range is 0 - Delete Row

I'm trying to write some code that deletes a row if the sum of the values from B:H = 0. (Or if all values from B:H are 0)

Currently i'm trying

Dim t
For t = (9 + UBound(Champ) + UBound(Champ)) To (9 + UBound(Champ)) Step -1
    If WorksheetFunction.CountA(Range(Cells(t, 2), Cells(t, 8))) = 0 Then
        Rows(t).EntireRow.Delete
    End If
Next t

However when I run this in my code nothing happens. No errors and certainly no Rows deleted. Any ideas?

Aucun commentaire:

Enregistrer un commentaire