I am not sure which ColorFunction you are using as there are a handful of them out there. I just stole the one from Ozgrid and edited it...
neil.crawford.zip
<table width="100%" border="1" bgcolor="White" style="filter
rogid:DXImageTransform.Microsoft.Gradient(endColorstr='#C0CFE2', startColorstr='#FFFFFF', gradientType='0');"><tr><TD><font size="2" face=Courier New> <font color="#0000A0">Function</font> ColorFunction(rColor <font color="#0000A0">As</font> Range, rRange <font color="#0000A0">As</font> Range, OffsetColumns, OffsetValue)
<font color="#0000A0">Dim</font> rCell <font color="#0000A0">As</font> Range
<font color="#0000A0">Dim</font> lCol <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
<font color="#0000A0">Dim</font> vResult
<font color="#008000">''''''''''''''''''''''''''''''''''''''</font>
<font color="#008000">'Written by Ozgrid Business Applications</font>
<font color="#008000">'www.ozgrid.com</font>
<font color="#008000">'Sums or counts cells based on a specified fill color.</font>
<font color="#008000">'''''''''''''''''''''''''''''''''''''''</font>
lCol = rColor.Interior.ColorIndex
<font color="#0000A0">For</font> <font color="#0000A0">Each</font> rCell <font color="#0000A0">In</font> rRange
<font color="#0000A0">If</font> rCell.Interior.ColorIndex = lCol <font color="#0000A0">And</font> rCell.Offset(, OffsetColumns) = OffsetValue <font color="#0000A0">Then</font>
vResult = WorksheetFunction.SUM(rCell, vResult)
<font color="#0000A0">End</font> <font color="#0000A0">If</font>
<font color="#0000A0">Next</font> rCell
ColorFunction = vResult
<font color="#0000A0">End</font> <font color="#0000A0">Function</font>
</FONT></td></tr></table><button onclick='document.all("9142006231243281").value=document.all("9142006231243281").value.replace(/<br \/>\s\s/g,"");document.all("9142006231243281").value=document.all("9142006231243281").value.replace(/<br \/>/g,"");window.clipboardData.setData("Text",document.all("9142006231243281").value);'>Copy to Clipboard</BUTTON><textarea style="position:absolute;visibility:hidden" name="9142006231243281" wrap="virtual">
Function ColorFunction(rColor As Range, rRange As Range, OffsetColumns, OffsetValue)
Dim rCell As Range
Dim lCol As Long
Dim vResult
''''''''''''''''''''''''''''''''''''''
'Written by Ozgrid Business Applications
'www.ozgrid.com
'Sums or counts cells based on a specified fill color.
'''''''''''''''''''''''''''''''''''''''
lCol = rColor.Interior.ColorIndex
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol And rCell.Offset(, OffsetColumns) = OffsetValue Then
vResult = WorksheetFunction.SUM(rCell, vResult)
End If
Next rCell
ColorFunction = vResult
End Function</textarea>
neil.crawford.zip