title: Copy and Paste using array in VBA
body: <p>I am trying to create a relatively simple copy and paste procedure. I have certain cell addresses stored in an array (Results1()) and I am trying to extrapolate the row which it is in to copy an entire row of data into another Excel sheet. I have the following so far and currently I am getting an object required error when I try to define what my 'NextRow' is. Any advice or feedback would be greatly appreciated!</p>
  
  <pre><code>For i1 = LBound(Results1) To UBound(Results1)
      Set NextRow = Worksheets("searchresult").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
                  Range(Results(i1)).EntireRow.Copy NextRow
  Next i1
  </code></pre>
  
  <p>Editted code</p>
  
  <pre><code>    For i1 = LBound(Results1) To UBound(Results1)
          Worksheets("properties").Select
          Set p1results = Range(Results1(i1))
          p1results.EntireRow.Copy
              With Worksheets("SearchResult").Select
                  NextRow = Range("D65536").End(xlUp).Row + 1
                  Cells(NextRow, 1).Select
                  ActiveSheet.Paste
              End With
      Next i1
  </code></pre>
  
  <p>Update: In actuality my data ranges only range from columns D:P so when I count rows I count from column D (4) because columns A-C are empty ranges.  Would this affect the way it is pasting my data?</p>
  
  <pre><code>       On Error Resume Next
     For i1 = LBound(Results1) To UBound(Results1)
          Set NextRow = shSearchResult.Cells(shSearchResult.Rows.Count, 4).End(xlUp).Offset(1, 0)
          shProperties.Range(Results1(i1)).EntireRow.Copy NextRow
          If Err.Number &lt;&gt; 0 Then
              Err.Clear
              MsgBox "Bad address" &amp; Results1(i1)
          End If
      Next i1
  </code></pre>