title: vba loop until boolean is false - userform button
body: <p>I want to execute a sub over and over again while a button is set true.
  My first idea would be a while or do while loop but I cant quite figure out how its done properly. In my case Excel just stops running.</p>
  
  <p>A Userform Button sets the boolean "status" true or false when pressed. If the "status" is true the sub should be executed in a loop. The sub itself triggers a calculation which adds an amount of money to the double "bank". If the same button is pressed again the loop should end.</p>
  
  <pre><code>Function aktivate(i As Integer)
      array(i).status = True
      call myLoop(i)
  End Function
  
  
  Function deaktivate(i As Integer)
      array(i).status = False
  End Function
  
  
  Function myLoop(i As Integer)
      Do While array(i).status = True
          Call calc(i)
  
          If array(i).status = False Then Exit Do
      Loop
  End Function
  </code></pre>