title: Copy rows onto new workbook based on column value
body: <p>I'm currently creating a new workbook on the fly and was wondering how you copy across data if certain conditions are met i.e. in this case if Primary Contact = John and Primary Device = Desktop then copy across the ID, First Name, Last Name and Email columns into the new workbook that was just created under column/row <em>A11 onwards, B11 onwards, C11 onwards, D11 onwards</em> (depending on how much data is pulled). Is this possible?</p>
  
  <p><img src="https://i.stack.imgur.com/2V890.png" alt="enter image description here"></p>
  
  <p>This is my code so far:</p>
  
  <pre><code>Sub NewWb()
  
  ' Create new workbook with a pre-defined name
  Workbooks.Add
  NewBook = ActiveWorkbook.Name
  ThisWorkbook.Activate
  Workbooks(NewBook).Activate
  
  ' Set bg to white
  ActiveWorkbook.Sheets("Sheet1").Cells.Interior.ColorIndex = 2
  
  ' Sanity test
  'MsgBox (ThisWorkbook.Sheets("Master").Cells(3, 3).Value)
  'MsgBox (ActiveWorkbook.Sheets("Sheet1").Cells(7, 1).Value)
  
  ' Get last row
  LastRow = ThisWorkbook.Sheets("Master").Cells(Rows.Count, "A").End(xlUp).Row
  
  ' Pull out relevant data from master spreadsheet where column F = "John"
  With ThisWorkbook.Sheets("Master")
      .AutoFilterMode = False
      .Range("A2:Z2").AutoFilter Field:=6, Criteria1:="John"
      ' Copy and paste NBK
      .Range("A2:A" &amp; LastRow).Copy
          ActiveWorkbook.Sheets("Sheet1").Range ("A11")
  End With
  
  Application.ScreenUpdating = False
  Application.EnableEvents = False
  Application.Calculation = xlCalculationAutomatic
  
  End Sub
  </code></pre>