title: Excel VBA hlookup function
body: <p>I am trying to use the excel VBA HLookup function. I have tried it two ways and both produce error. Could anyone explain me what is that I am doing wrong?</p>
  
  <p>First try:</p>
  
  <pre><code>    lookupValue = Worksheets(1).Name &amp; "!A1"
      tableArray = Worksheets(3).Name &amp; "!$A$1:$" &amp; Col_letter &amp; "$1"
      Worksheets("Comparison").Cells(1, 2).Value = "=HLookup(" &amp; lookupValue _
      &amp; ";" &amp; tableArray &amp; ";1;FALSE)"
  </code></pre>
  
  <p>Second try:</p>
  
  <pre><code>    tda = Worksheets(1).Cells(1, 1).Value ' I also tried using tda without .Value
      Table = Worksheets(3).Range(Cells(1, 1))
      Worksheets("Comparison").Cells(1, 2).Value = WorksheetFunction. _
      HLookup(tda, Table, 1, False)
  </code></pre>