Function Basic Extensions Class

TrueEveryNCalls

Function returns True every Nth time that it is called.

Signature (Visual Basic / VBA)

Public Function TrueEveryNCalls( _
    Optional ByVal vNthCall As Variant _
    ) As Boolean

Code Example

    TrueEveryNCalls(0) = True ' #1; Reset counter.
    TrueEveryNCalls(3) = False
    TrueEveryNCalls(3) = False
    TrueEveryNCalls(3) = True

Parameters

Parameter Description
vNthCall The number of calls to this function before the function returns True. vNthCall defaults to 0 (zero) if it is missing or Null or cannot be fixed up to a number, meaning that the function will return True and the counter will be reset as in example #1.

Return Value

Function returns True if vNthCall is missing, Null, cannot be fixed up to a number, or is <= 0 (less than or equal to zero), Otherwise, if vNthCall is a positive number, it returns True after it has been called vNthCall times, or it returns False.