Public Function Factorial(N As Integer) As Integer If N <= 1 Then Factorial = 1 Else Factorial = Factorial(N - 1) * N End If End Function Sub res() Debug.Print Factorial(4) End Sub