这是我的代码
Sub lab1()
Dim first As Integer
Dim third As Integer
Dim total As Integer
total = 0
For i = 0 To i = 99
first = Application.WorksheetFunction.RandBetween(1, 100)
total = total + first
Next i
MsgBox (total)
End Sub
我正在尝试生成 100 个介于 1 到 100 之间的随机数,并将每个数字存储到变量“total”中。我不明白为什么总的值总是低于 100 ,似乎“总”只存储 1 个随机数而不是 100 个随机数