title: Error 2042 when using application.match in VBA
body: <p>I am trying to find the index of the integer in an array in VBA.</p>
  
  <p>I created the array as such.</p>
  
  <pre><code>Dim spot(11) as Integer
  For index = 1 To NoOfSpotValues
     spot(index) = Cells(15 + index, 7)
  Next
  </code></pre>
  
  <p>When I do:</p>
  
  <pre><code>posOfSpot = Application.Match(0, spot, False)
  </code></pre>
  
  <p>It gives me an error as
      <code>posOfSpot = Error 2042</code>.</p>
  
  <p>How do I solve it? Tried searching. Need some guidance on this.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <pre><code>Function Find(ByVal Value As Variant, arr As Variant) As Integer
  If arr.Exists(Value) Then
      index = arr(Value)
  Else
      index = -1
  End If
  </code></pre>