示例代码如下:
Sub LeiJia(X As Integer) Dim i as long,result For i=1 to X result=result+i Next i MsgBox "1到" & X & "的累加结果是:" & resultEnd sub
调用过程举例
Call LeiJia(100)