下面的代码Private Sub CommandButton1_Click() Dim n As Integer, s As Double, s2 As Double s = 1 s2 = 0 n = Val(InputBox("请输入一个整数:")) For i = 1 To n s = s * i s2 = s2 + i Next MsgBox n & "的阶乘为:" & s & Chr(10) & Chr(13) & "1+..." & n & "的和为:" & s2 End Sub