title: Copy and Pasting a row based on a condition
body: <p>Copy and Pasting an entire row based off of two conditions</p>
  
  <p>For a school project, I am trying to find all the rows that satisfy both (of two) conditions then paste the entire row at the end of my data set. I am trying to do this with variables as the spreadsheet may change in tests that my professor will perform. I keep getting a "Subscript out of range" error. My reading and assigning to P and T, for loop, if statements, and count functions all work.</p>
  
  <pre><code>numrow = Rows(Rows.Count).End(xlUp).row
  numcolumn = Columns(Columns.Count).End(xlUp).Column
  P = Range(Cells(3, 1), Cells(numrow, 1)).Value
  T = Range(Cells(3, 2), Cells(numrow, 2)).Value
  
  For i = LBound(P, 1) To UBound(P, 1)
      If P(i, 1) = 5 And T(i, 1) = 100 Then
         countrow = countrow + 1 'check: return is 25
  
         'Range(i, numcolumn).copy Sheets("Sheet1").End(xlUp).Offset(1, 0)
          Worksheets("Sheet1").Range(Cells(i, numcolumn)).Value.copy
          lastrow = ActiveSheet.Cells(1, 1).CurrentRegion.Rows.Count + 1
          Range(Cells(lastrow, 1)).PasteSpecial xlPasteFormulasAndNumberFormats
          Application.CutCopyMode = False
  'I would also like to change all the cells that were just pasted in the first column to the value of 2.5 here, but I have no idea where to start with that
      End If
  Next i
  </code></pre>
  
  <p>As you can see I tried it two ways
  1.)
  Range(i, numcolumn).copy Sheets("Sheet1").End(xlUp).Offset(1, 0)
  (which is commented for now)
  2.)
  Worksheets("Sheet1").Range(Cells(i, numcolumn)).Value.copy</p>
  
  <p>both get highlighted when I try to debug and have the "subscript out of range" error</p>