title: Pausing a VBA loop to allow editing of worksheet, with or without userform
body: <p>I have a procedure that consists of several <code>do</code> and <code>for</code> loops and i would like to find an easy way to 'pause' the routine and allow the user to edit the sheet, with a msgbox or userform to resume execution where it left off. </p>
  
  <p>I would like to do something like this</p>
  
  <pre><code>dim pause as boolean
  pause=false
  For i = 1 To 40
      Worksheets("sheet1").Range("A" &amp; i) = i
      If i = 20 Then
          UserForm1.Show vbmodeless
            Pause = true
          Do until pause = false
          loop
      Else
  
      End If
      Next i
  
  
  End Sub
  </code></pre>
  
  <p>Where the pause condition would be set by a sub on the userform. This do loop just crashes. </p>
  
  <p><strong>Ideally</strong> i would like the userform to have buttons that can run subs but also allow direct editing of cells while execution is paused.</p>