title: VBA copying data from one workbook to specific cells in another, based on criteria
body: <p>I have 2 workbooks and need to copy over data from rows that have a "yes" in the 26th column to specific cells in the destination workbook.
  I currently have the following code attached to a button on the source sheet:</p>
  
  <pre><code>Sub exportData()
  
  Dim LastRow As Integer 
  Dim i As Integer
  Dim erow As Integer
  
  LastRow = ActiveSheet.Range("A" &amp; rows.Count).End(xlUp).Row
  
  For i = 2 To LastRow
  
  If Cells(i, 26).Value = "Yes" Then
  
  
      Range(Cells(i, 1), Cells(i, 26)).Select
       Selection.Copy
  
      Workbooks.Open Filename:=ThisWorkbook.Path &amp; "\GI New Starter Tracker 2017edit.xlsx"
      Worksheets("Main").Select
      erow = ActiveSheet.Cells(rows.Count, 1).End(xlUp).Offset(1, 0).Row
  
      ActiveSheet.Cells(erow, 1).Select
  
      ActiveSheet.Paste
      'ActiveSheet.Range("$A$1:$AB$3000").RemoveDuplicates Columns:=2, Header:=xlYes
      ActiveWorkbook.Save
      ActiveWorkbook.Close
      Application.CutCopyMode = False
  
  
  End If
  Next i
  End Sub
  </code></pre>
  
  <p>The code works fine, however it copies over the entire row, but I only need to copy over certain information like "firstname", "Surname" "Date of birth". The target workbook doesnt have exactly the same headings so I need to be able to specify which column.</p>
  
  <p>Ive been pulling my hair out and would really appreciate any help.</p>
  
  <p>Thanks :)</p>