total = total + ActiveCell.Value ne fonctionne pas dans un pour chaque boucle

J'ai ce code où je veux searchr certaines cellules dans une autre feuille, et si elles correspondent aux critères, ajoute une cellule voisine au total qui est returnné à la cellule.

Function collectUtfall(A1 As Ssortingng, Ax As Ssortingng) Dim rng As Range Dim total As Long: total = 0 Set rng = Sheets("Utfall").Range("M2:O272") Dim cell As Range For Each cell In rng If StrComp(cell.Offset(0, 1).Text, Ax, vbTextCompare) = 0 Then total = total + ActiveCell.Value Else End If Next collectUtfall = total End Function 

Le problème est que j'obtiens une erreur de «Référence du cercle» lors de l'exécution. Existe-t-il un problème dans l'utilisation de ActiveCell.Value de cette façon?

Si j'essaye juste avec une valeur, dis 10, ça marche très bien:

 total = total + 10 

Le problème doit donc être avec ActiveCell.Value ?

 Function collectUtfall(A1 As Ssortingng, Ax As Ssortingng) Dim rng As Range Dim total As Long set total = 0 Set rng = Sheets("Utfall").Range("M2:O272") Dim cell As Range For Each cell In rng If StrComp(cell.Offset(0, 1).Text, Ax, vbTextCompare) = 0 Then total = total + Cell.Value Else End If Next Cell collectUtfall = total End Function