title: Application.ScreenUpdating stops macro execution in VBA
body: <p>I am not experienced VBA programmer, and I need community to find a problem with the Excel.</p>
  
  <p>My problem is that in Excel, code stops execution immediatly after following line:
  <code>Application.ScreenUpdating = True</code></p>
  
  <p>I use following example code from msdn website:</p>
  
  <pre><code>Dim elapsedTime(2) 
  Application.ScreenUpdating = True 
  For i = 1 To 2 
      If i = 2 Then Application.ScreenUpdating = False 
      startTime = Time 
      Worksheets("Sheet1").Activate 
      For Each c In ActiveSheet.Columns 
          If c.Column Mod 2 = 0 Then 
              c.Hidden = True 
          End If 
      Next c 
      stopTime = Time 
      elapsedTime(i) = (stopTime - startTime) * 24 * 60 * 60 
  Next i 
  Application.ScreenUpdating = True 
  MsgBox "Elapsed time, screen updating on: " &amp; elapsedTime(1) &amp; _ 
       " sec." &amp; Chr(13) &amp; _ 
       "Elapsed time, screen updating off: " &amp; elapsedTime(2) &amp; _ 
       " sec."
  </code></pre>
  
  <p>Source: <a href="http://msdn.microsoft.com/en-us/library/office/ff193498.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/office/ff193498.aspx</a></p>
  
  <p>However, Msgbox never get executed, nor VBA shows any error - it just silently fails.</p>
  
  <p>Anyidea why this is happening and how to fix that ? </p>