View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John[_140_] John[_140_] is offline
external usenet poster
 
Posts: 57
Default Count merged cells as if unmerged

I had this neat macro that counts how many cells are a certain color:



Public Function CountColors(color As String) As Integer

Dim intCount As Integer

Dim cell As Range



For Each cell In Range("ThisRange").Cells

If cell.Interior.color = 825735 Then intCount = intCount + 1

Next cell

CountColors = intCount

End Function



The problem is, I have merged some cells. How can I get a macro to count
say, 3 cells merged into 1 as three cells, not 1, if they match a certain
color?.