title: How to display Progress Bar while macro runs?
body: <p>I created a ProgressBar I want to display with % while my macro runs.</p>
  
  <p>I tried the parameters <code>UserForm1.Show vbModeless</code> and <code>UserForm1.Repaint</code> in my main macro.</p>
  
  <pre><code>Private Sub UserForm_Activate()    
      Dim reminder As Long        
      Dim i As Long, j As Long
  
      reminder = 0
  
      For i = 1 To 200        
          UserForm1.Label2.Width = UserForm1.Label2.Width + 1
  
          If i Mod 2 = 0 Then        
              reminder = reminder + 1        
              UserForm1.Caption1 = reminder &amp; " % completed"        
          End If
  
          For j = 1 To 150        
              DoEvents        
          Next j        
      Next i
  
      Unload UserForm1    
  End Sub
  </code></pre>
  
  <p>The UserForm stops on 0% and my main macro runs to the end, then the UserForm with ProgressBar runs from 0 to 100% and closes.</p>