Function COMPTE#(plage As Range, societe As String, n As Long)
Dim W As Worksheet, cel As Range
Set W = Worksheets("Comptes " & societe)
For Each cel In plage
If Application.Subtotal(3, cel) Then _
COMPTE = COMPTE + Application.SumIf(W.[A:A], cel, W.[B:B])
Next
End Function