title: Excel Macro: conditional cut and paste between workbooks
body: <p>So I want a macro running in an Excel file ("input.xls") that is searching a column in another Excel file ("data.xls") for the value "1" (the only values in that columns are 1s and 0s). When it finds a "1," it should copy and paste the entire row from that file into "input.xls".</p>
  
  <p>Here is the code that I have</p>
  
  <pre><code>Sub NonErrorDataParse()
      Dim intEnd As Integer
  
      Workbooks("data.xls").Sheets("Raw").Activate
  
      intEnd = 65000
  
      Range("F").Select
  
      Do Until ActiveCell.Row = intEnd
  
          If Int(ActiveCell.Value) = 1 Then
              Range(ActiveCell.Row &amp; ":" &amp; ActiveCell.Row).Cut
              intEnd = intEnd - 1
              Workbooks("input.xls").Sheets("Non-errors").Activate
              Range("A1").Select
              ActiveSheet.Paste
          Else
              ActiveCell.Offset(1, 0).Select
          End If
  
      Loop
  
  End Sub
  </code></pre>
  
  <p>However, when I run it, it gives me a "subscript out of range" error on "data.xls." No matter how I fiddle with the code I can't seem to get past that error (even though I have OTHER macros that are accessing that sheet that work fine). </p>
  
  <p>Any ideas as to how to fix it? Or better code that will do the same thing?</p>
  
  <p>Thanks in advance</p>