title: VBA Count occurrence of an element in a multi-dimensional array, how?
body: <p>I have defined a multi-dimensional array using range in vba, for example</p>
  
  <pre><code>Dim Arr() as Variant 
  Arr = Range("A1:F5")
  </code></pre>
  
  <p>This resulted the a 5x6 array Arr(1,1) to Arr(5,6)</p>
  
  <p>I want to count the occurrence of a string, say "ABC" in Arr(5) (i.e. Row 5) only.</p>
  
  <p>The following code can find the count of "ABC" in the all of the array</p>
  
  <pre><code>For Each x in Arr
    if x = "ABC" then Cnt = Cnt + 1
  Next
  </code></pre>
  
  <p>But if only want to count dimension 5, Arr(5) return an error.</p>