Categories




factorial function

Public Function Factorial(ByVal Factor As Byte) As Variant

On Error GoTo ErrorHandler
If Factor = 0 Then
Factorial = 1
Else
Factorial = Factor * Factorial(Factor – 1)
End If
Exit Function

ErrorHandler:
MsgBox Err.Description
End Function

Private Sub Form_Load()
MsgBox Factorial(3)
End Sub

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>