title: VBA Macro crashes after 32000 rows
body: <p>I have a VBA macro that copies rows from one worksheet into another based upon finding values in cells in 3 columns. The macro works, but crashes when it reaches row 32767. There are no formulas or special formatting in this row. Further, I have taken that row out, but it still crashes on that row number. Is this a limitation in excel? There are some 43000 in the worksheet that is being process</p>
  
  <p>Therefore, I ask what is wrong with my macro and how I can get it reach the end of the worksheet:</p>
  
  <pre><code>Dim LSearchRow As Integer
  Dim LCopyToRow As Integer
  Dim wks As Worksheet
  On Error GoTo Err_Execute
  </code></pre>
  
  <p>For Each wks In Worksheets</p>
  
  <pre><code>LSearchRow = 4
  LCopyToRow = 4
  
  ThisWorkbook.Worksheets.Add After:=Worksheets(Worksheets.Count)
  Set wksCopyTo = ActiveSheet
  wks.Rows(3).EntireRow.Copy wksCopyTo.Rows(3)
  
  While Len(wks.Range("A" &amp; CStr(LSearchRow)).Value) &gt; 0
  
      If wks.Range("AB" &amp; CStr(LSearchRow)).Value = "Yes" And wks.Range("AK" &amp; CStr(LSearchRow)).Value = "Yes" And wks.Range("BB" &amp; CStr(LSearchRow)).Value = "Y" Then
  
          Rows(CStr(LSearchRow) &amp; ":" &amp; CStr(LSearchRow)).Select
          Selection.Copy
  
  
          wksCopyTo.Select
          wksCopyTo.Rows(CStr(LCopyToRow) &amp; ":" &amp; CStr(LCopyToRow)).Select
          wksCopyTo.Paste
  
          'Move counter to next row
          LCopyToRow = LCopyToRow + 1
          'Go back to Sheet1 to continue searching
          wks.Select
      End If
      LSearchRow = LSearchRow + 1
  Wend
  
  Application.CutCopyMode = False
  Range("A3").Select
  MsgBox "All matching data has been copied."
  Next wks
      Exit Sub
  Err_Execute:
      MsgBox "An error occurred."
  </code></pre>
  
  <p>Please help!</p>