这个用循环语句计算比较方便,例如 do while 语句 ,do loop语句,for next 语句都可以
for next 语句举例:
Private Sub Command1_Click()
Dim i%, iSum
For i = 0 To 4 Step 2
iSum = i + iSum
Debug.Print i
Debug.Print
Next
Debug.Print iSum
End Sub
更多帮助请登录www.shangying.com加技术Q Q即可
dim i as integer
dim sum as long
sum=0
for i=2 to 100 step 2
sum=sum+i
next
msgbox "2+4+6+8+到100的和为:" & sum
试试吧