Thread: Count Formats
View Single Post
  #4   Report Post  
Jack Sons
 
Posts: n/a
Default

Matt,

During the years I gathered a lot of handy code. I once found these macro's.
Just what you need.

Jack Sons
The Netherlands
----------------------------------------------------------------------------------------------------
Sub SumColorCountYellow()
Dim Yellow6 As Integer
Dim Cell As Range

For Each Cell In Range("DataY")
If Cell.Interior.ColorIndex = 6 Then
Yellow6 = Yellow6 + Cell.Value
End If
Next
originalF = Range("F1").Value
Range("F1").Value = "Yellow = " & Yellow6

MsgBox " Yellow adds to " & Yellow6, _
vbOKOnly, "CountColor"

Range("F1").Value = originalF '""
End Sub
---------------------------------------------------------------------------------------------
Function BoldSum(rng)
' sommeert de vette cellen in de range
Dim c
For Each c In rng
If c.Font.Bold Then
BoldSum = BoldSum + c.Value
End If
Next

End Function
-------------------------------------------------------------------------------------------------

"Matt" schreef in bericht
...
Can you use a count function to count the number of cells with a
particular
format, say a colour?