title: Match Function in Specific Column Excel VBA
body: <p>I'm trying to write a program in VBA for Excel 2011 that can search a column (which column that is is determined by another variable) for the number 1 so that it knows where to start an iteration. </p>
  
  <p>Say that the number of the column is given by <code>colnumvar</code>. The only way I can think of is the Match function, which led me to write the following:</p>
  
  <pre><code>Dim rowvar As Integer
  rowvar = WorksheetFunction.Match(1,Range(Cells(1,colnumvar),Cells(1000,colnumvar)),0) 
  </code></pre>
  
  <p>This gave me an error, however. After playing around with it some more, I realized that it must not accept the <code>Cells([row],[col])</code> way of doing it, but rather wants something like <code>Range("A1:A100")</code>. Unfortunately, I can't do it that way, since the program is figuring out what column to look in. Any help for figuring out how to get past this would be greatly appreciated! </p>