title: Excel VBA - Copy cells based on criteria to another workbook saved in the same folder
body: <p>I'm pretty  new at this and I've gone through a ton of bundle of tutorials but I can't seem to grasp the concept of how to achieve this result in excel VBA. I'll try being as detailed as possible.</p>
  
  <p>I have a folder with 3 x Excel files - </p>
  
  <ul>
  <li><strong>Script.xlsx</strong> (Just a button that holds the script/macro)</li>
  <li><strong>WhiteCrown.xlsx</strong> (the workbook I'd like to copy the data from)</li>
  <li><strong>PackCon.xlsx</strong> (the workbook I'd like the data pasted into)</li>
  </ul>
  
  <p>Concept: 
  If Workbook ("WhiteCrown.xlsx") contains value in Column B5:B10000 which = Workbook ("PackCon.xlsx") Column B5:B10000 AND Workbook ("WhiteCrown.xlsx") contains a value in Column E</p>
  
  <p>There are 2 cells I don't want the value of E copied - "soy-milk" "Pepsi-max"</p>
  
  <p>The check is to be looped till column b 
  Reaches 10000 </p>
  
  <p>:) thanks in advance </p>
  
  <pre><code>Sub ConvertData()
  
  Dim i As Integer, n As Integer
  Dim Desc As Range, ExDesc As Range
  Dim wb1 As Workbook, wb2 As Workbook
  Dim ws1 As Worksheet, ws2 As Worksheet
  Dim rngLookup As Range
  Dim v
  
  Application.ScreenUpdating = False
  
  Set wb1 = Workbooks.Open("C:\Users\amir.abdul\Desktop\Completed\New folder\WhiteCrown.xlsx")
  Set ws1 = wb1.Sheets("BOMQ")
  
  Set wb2 = Workbooks.Open("C:\Users\amir.abdul\Desktop\Completed\New folder\PackCon.xlsx")
  With wb2.Sheets("("BOMQ")")
      Set rngLookup = .Range(.Cells(7, 2), _
                      .Cells(7, 2).End(xlDown)).Resize(, 3)
  End With
  
  With ws1
      i = 7
      Do Until .Cells(i, 2) = ""
          v = Application.VLookup(.Cells(i, 2).Value, rngLookup, 3, False)
          If Not IsError(v) Then .Cells(i, 4).Value = v
          i = i + 1
      Loop
  End With
  
  wb2.Close False
  
  
  End Sub
  </code></pre>
  
  <p>*Script updated but still not working</p>