title: Excel VBA Vlookup returning - Error 2042
body: <p>I'm trying to do a Vlookup but it is returning Error 2042, even if there is a match. I cannot figure out what is wrong with the code. Any help will be appreciated.</p>
  
  <pre><code>Private Sub F6P_SORT()
  
  Dim targetWorkbook As Workbook
  Dim sourceSheet As Worksheet
  Dim targetSheet As Worksheet
  Dim LastRow As Long
  
  Set targetWorkbook = Application.ActiveWorkbook
  Set targetSheet = targetWorkbook.Worksheets("MTD")
  
  On Error Resume Next
  Dim Table1 As Range
  Dim Table2 As Range
  Dim Table3 As Range
  
  Dim IniName_Row As Long
  Dim IniName_Clm As Long
  
  LastRow = targetSheet.Range("A65536").End(xlUp).Row
  Set Table1 = targetSheet.Range("A2:A" &amp; LastRow) ' CC/IO from MTD
  Set Table3 = targetSheet.Range("F2:F" &amp; LastRow) ' Ini Name to MTD
  
  Set sourceSheet = targetWorkbook.Worksheets("IO Lookup")
  LastRow = sourceSheet.Range("A65536").End(xlUp).Row
  Set Table2 = Sheet1.Range("A2:D" &amp; LastRow) ' IO from IO Lookup
  
  
  IniName_Row = Table3.Row
  IniName_Clm = Table3.Column
  
  For Each cl In Table1
      targetSheet.Cells(IniName_Row, IniName_Clm) = Application.VLookup(cl, Table2.Value, 4, False)
      IniName_Row = IniName_Row + 1
  Next cl
  
  End Sub
  </code></pre>