title: create a macro to copy multiple rows of data from one sheet to another based on a criteria
body: <p>I am trying to write a macro that will let me copy a range of data from one sheet to another sheet based on a criteria in the column before the column to be copied.</p>
  
  <p>Column B is the criteria column. If there is a 1 in any row in this column then columns C thru AN will be copied from that row where there is a 1 and be pasted into another sheet starting at the top of that sheet.</p>
  
  <p>I have the following code. It locates the first row that satisfies the criteria and copies this row to the second sheet, however the code does not loop thru to find other rows that satisfy the criteria. How can I adjust the code to loop and copy each instance where the criteria is satisfied?</p>
  
  <pre><code>Sub testIt()
  
  Dim i As Integer
  
      Application.ScreenUpdating = False
  
      Sheets("DataDump").Activate
  
      For i = 2 To Range("B2").End(xlDown).Row()
          If Range("B" &amp; i).Value = 1 Then
              Range("C" &amp; i, "AN" &amp; i).Copy
              Sheets("PriceData").Activate
              ActiveSheet.Range("B2", "AM2").Select
              ActiveSheet.Paste
          End If
      Next i
  
      Application.ScreenUpdating = True
  
  End Sub
  </code></pre>