title: Difference between INDEX/MATCH in worksheet and in VBA
body: <p>This is driving me absolute mental and I just can't see what the difference is.</p>
  <p>In my excel worksheet</p>
  <pre><code>=INDEX(BE1home[[GF ]];MATCH(TRIM(Sheet4!B10);BE1home[[  2]];0);1)
  </code></pre>
  <p>In VBA</p>
  <pre><code>WorksheetFunction.Index(Sheets(&quot;Sheet3&quot;).ListObjects(&quot;BE1home&quot;).ListColumns(&quot;GF &quot;).DataBodyRange, WorksheetFunction.Match(Trim(sq1(i, 1)), Sheets(&quot;Sheet3&quot;).ListObjects(&quot;BE1home&quot;).ListColumns(&quot; 2&quot;).DataBodyRange, 0))
  </code></pre>
  <p>The excel worksheet formula works but the VBA one doesn't and I just can't figure out why. In VBA I keep getting Subscript out of range.</p>
  <p><strong>Extra info</strong></p>
  <p>sq1(i,1) is the same value as Sheet4!B10. I have to trim it as there is a trailing space.
  The list where I'm trying to get the data form is in Sheet3 but the results are in Sheet4.</p>