title: Excel UDF function runs very slow when selecting entire column
body: <p>I have a function i got off of MSDN that counts the number of cells in a range that have a another cells color.</p>
  
  <p>Here is the code</p>
  
  <pre><code>Function countCcolor(range_data As Range, criteria As Range) As Long
      Application.Volatile
      Application.ScreenUpdating = False
      Dim datax As Range
      Dim xcolor As Long
  xcolor = criteria.Interior.ColorIndex
  For Each datax In range_data
      If datax.Interior.ColorIndex = xcolor Then
          countCcolor = countCcolor + 1
      End If
  Next datax
  Application.ScreenUpdating = True
  End Function
  </code></pre>
  
  <p>The only reason I put the whole column is I need it to update if a value in that column is changed, in reality there will probably never be more than 200 rows (right now there is 85) so it shouldn't be running this slow.</p>