title: Why random number generated is not stored in variable
body: <p>This is my code</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I am trying to generate 100 random numbers between 1 to 100 and store each number into the variable 'total'. I cant understand why the value of total is always like below 100 , it seems like that 'total' is only storing 1 random number not 100 random number </p>