title: VBA Match variable range
body: <p>I have a problem with the <code>.Match</code> function. If I set a range inside it with quotes and letters ("A:A") it goes well. But when I try to set it with variable, it gives a 1004 error.</p>
  
  <p>This works:</p>
  
  <pre><code>a = WorksheetFunction.Match(Range("A1"), Sheets("Data").Range("A:A"), 0)
  </code></pre>
  
  <p>This doesn't work:</p>
  
  <pre><code>a = WorksheetFunction.Match(Range("A2"), Sheets("Data").Range(Cells(a, 4), Cells(a + 5, 4)), 0)
  </code></pre>
  
  <p>How do I set a range with variables in a <code>.Match</code> function?</p>