
Option Explicit Public Function SumAlterna(Valore As Double, Celle As Range, Ste_p As Integer) As Double Dim celV As Variant Dim i As Long Dim SA As Double SA = 0 i = 0 For Each celV In Celle If i = 0 And celV = Valore Then SA = SA + celV i = i + 1 ElseIf i <= Ste_p Then i = i + 1 Else i = 0 End If Next SumAlterna = SA End Function |
Option Explicit Public Function SumAlterna(Valore As Double, Celle As Range, Ste_p As Integer) As Double Dim celV As Variant Dim i As Long Dim SA As Double SA = 0 i = 0 For Each celV In Celle If i = 0 And celV = Valore Then SA = SA + 1 i = i + 1 ElseIf i <= Ste_p Then i = i + 1 Else i = 0 End If Next SumAlterna = SA End Function |
