lundi 25 septembre 2017

Excel VBA - If cell function is =SUM(#REF!) Then change value to 0

I'm trying to write some code where if the cell's function in a range is =SUM(#REF!) Then change the value of that cell to 0

Currently I have

Dim cell As Range
For Each cell In Range(Cells(5 + UBound(Champ), 2), Cells(5 + UBound(Champ), 8))
If cell.Formula = "=SUM(#REF!)" Then
cell.Value = 0
End If
Next cell

But when i run it nothing happens. Any idea where i'm going wrong?

Aucun commentaire:

Enregistrer un commentaire