title: Vba Excel Vlookup Search value is String
body: <p>The code below doesn't work </p>
  
  <blockquote>
    <p>run time error 1004</p>
  </blockquote>
  
  <p><code>VlookSrc</code> (Dim As String in VBA) is the value we look for in <code>Range("KV5:KW105673")</code>. It's a combination of different cells depending on c and d, and the string <code>/DIR/</code> in between.
  In the local window it is possible to see that Excel recognizes the correct string.
  We use the <code>IfError</code> Function because there won't always be value found.
  The run error 1004 comes with the worksheetfunction.</p>
  
  <pre><code>    If Cells(3, d) = Cells(c, 33) Then
          VlookSrc = Cells(c, 48).Value &amp; "/DIR/" &amp; Cells(4, d).Value
         Cells(c, d) = Application.WorksheetFunction.IfError(Application.WorksheetFunction.VLookup(VlookSrc, Range(Cells(5, 308), Cells(105673, 309)), 2, False), 0)
      Else
          Cells(c, d) = 0
      End If
  </code></pre>