Private Function f(ByVal n As Long) As Long Dim i As Integer f = 1 If n = 0 Or n = 1 Then f = 1 Else For i = 1 To n f = f * i Next i End If End Function Private Sub Command1_Click() Dim n As Long n = Val(Text1) Text2 = f(n) End Sub Private Sub Command2_Click() Text1 = "" Text2 = "" End Sub Private Sub Command3_Click() End End Sub