title: How do I fix "not responding"?
body: <p>How do I fix the <code>Not Responding</code> error in Excel VBA?</p>
  <p>My code is perfect, I'm not getting any error but after I run it, I will see <code>NOT RESPONDING</code> top of Excel VBA and Excel doesn't respond anymore.</p>
  <p>I am writing vba code to find the match numbers between two sheets: <code>Sheet1</code> holding 5000 numbers and <code>Sheet2</code> holding 4500 numbers. When I run it, my code run it for 10 secs then excel freezing on me and not responding msg appear top of the screen.</p>
  <p><em>When I compary only 100 numbers between two sheets, it works perfectly and not responding message does not appear.</em> It only occurs when I compare 10000 numbers together or larger amount of numbers.</p>
  <p>Once again this code is working perfectly, when I am comparing only 100 numbers. But when I try to do larger numbers between two sheets, <em>&quot;not responding&quot; appears and excel freezes.</em> Here is my code <em>and I did try screenupdate or others, but nothing helpes.</em> I will really appreciate, if someone help me out.</p>
  <pre><code>     Dim Sheet1rows As Long, Sheet2rows As Long, a as long, j as long
        j = 1
        a = 1
        Sheet1rows = Sheets(&quot;Sheet1&quot;).UsedRange.Rows.Count + 1
        Sheet2rows = Sheets(&quot;Sheet2&quot;).UsedRange.Rows.Count + 1
  
       For i = a To Sheet1rows
         For ii = a To Sheet2rows
  
      'this one is copying between to sheets
  
          If Sheets(&quot;Sheet1&quot;).Cells(i, 1) = Sheets(&quot;Sheet2&quot;).Cells(ii, 1) Then
           Sheets(&quot;Sheet3&quot;).Range(&quot;A&quot; &amp; j) = Sheets(&quot;Sheet1&quot;).Cells(i, 1)
          j = j + 1
         next ii
       next i
  </code></pre>