And here is the function for counting cells with text colours:
Function CountColours(MyRange As Range, TestCell As Range) As Double
Dim cell As Range
Application.Volatile True
For Each cell In MyRange
If cell.Font.ColorIndex = TestCell.Font.ColorIndex Then...
Right @matt:
Here is the function for counting colours, based on the text colour of a particular cell:
Function SumIfColours(MyRange As Range, TestCell As Range) As Double
Dim cell As Range
Application.Volatile True
For Each cell In MyRange
If cell.Font.ColorIndex =...
You can change the bit that says If cell.Font.Bold = True Then to If cell.Font.ColorIndex = <the number of the colour you want to test> Then
Colour numbers are here: http://msdn.microsoft.com/en-us/library/office/ff840443(v=office.15).aspx
So for black, the code would read If...
OK, this works in Excel 2000. I haven't got 2010, but I don't see why it will not work in that:
Open up the Visual Basic Editor (Alt F11) and insert a new module:
Function SumIfBold(MyRange As Range) As Double
Dim cell As Range
For Each cell In MyRange
If cell.Font.Bold =...