title: Performing Vlookup from different workbook
body: <p>I am trying to do a vlookup using VBA. The reference data is in another workbook.<br />
  I was thinking to assign a variable for the data workbook &amp; worksheet, but wasn't able to make it work. The sub runs, but does not return any result in the desired worksheet.</p>
  <p><strong>WbVlookup</strong> is the variable for vlookup data workbook<br />
  <strong>BuildplanRange</strong> is the variable for vlookup data range<br />
  The code needs to run from Row 14 to the last result row</p>
  <p>It seems to me the variable wasn't assigned correctly for both workbook and datarange, but I wasn't able to figure out what was wrong.</p>
  <pre class="lang-vb prettyprint-override"><code>Sub VlookupForColumnGHIJ()
  
  Dim EndofRow As Long
  Dim RowX As Integer
  Dim WbVlookup As Workbook
  Dim BuildplanRange As Range
  
  Set WbVlookup = Workbooks.Open(&quot;C:\Users\DengSilin\Downloads\Copy of 98289 (FL512S)_Allocation File_WW18 (002)_Cindy_02022021.xlsx&quot;)
  Set BuilPlanRange = WbVlookup.Worksheets(&quot;Build Plan&quot;).Column(&quot;F:I&quot;)
  
  EndofRow = Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row
  For RowX = 14 To EndofRow
      Cells(RowX, 6) = Application.WorksheetFunction.VLookup(Cells(RowX, 3), BuilPlanRange, 2, 0)
  Next RowX
  
  End Sub
  </code></pre>