title: VBA to count cells matching color and specific text
body: <p>I am trying to get VBA code to count cells in a range that match by cell fill color and by the text within.</p>
  
  <p>I can get one criteria at a time easy enough, but every time I try to combine the conditions I get VALUE error. Please help!</p>
  
  <p>This is what I have: </p>
  
  <ul>
  <li>G23-100 is the range</li>
  <li>F19 is the color and text to match  </li>
  </ul>
  
  <p>.</p>
  
  <pre><code>Function CountColorValue()
      Dim text As String
      Dim cell As Range
      For Each cell In Range("G23:G210")
          If cell.Interior.ColorIndex = Range("F19").Interior.ColorIndex Then
              If cell.text Like Range("F19").text Then
                  text = text + 1
              End If
          End If
      Next cell
      Cells(1, 2).Value = numbers
  End Function
  </code></pre>
  
  <p>It doesn't work, hence I am here..
  Thanks in advance for any help.</p>