neil.crawford2.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> CountColors(LookupColor <font color="#0000A0">As</font> Range, ColorLookupRange <font color="#0000A0">As</font> Range, _
LookupValue, ValueLookupRange <font color="#0000A0">As</font> Range)
<font color="#0000A0">Dim</font> c <font color="#0000A0">As</font> Range
<font color="#0000A0">Dim</font> ColorIndex <font color="#0000A0">As</font> <font color="#0000A0">Variant</font>
<font color="#0000A0">Dim</font> cIndex <font color="#0000A0">As</font> <font color="#0000A0">Long</font>
ColorIndex = LookupColor.Interior.ColorIndex
<font color="#0000A0">For</font> <font color="#0000A0">Each</font> c <font color="#0000A0">In</font> ValueLookupRange
cIndex = cIndex + 1
<font color="#0000A0">If</font> c.Value = LookupValue <font color="#0000A0">Then</font>
<font color="#0000A0">If</font> ColorLookupRange(cIndex).Interior.ColorIndex = ColorIndex <font color="#0000A0">Then</font>
CountColors = CountColors + 1
<font color="#0000A0">End</font> <font color="#0000A0">If</font>
<font color="#0000A0">End</font> <font color="#0000A0">If</font>
<font color="#0000A0">Next</font> c
<font color="#0000A0">End</font> <font color="#0000A0">Function</font>
</FONT></td></tr></table><button onclick='document.all("922200615457906").value=document.all("922200615457906").value.replace(/<br \/>\s\s/g,"");document.all("922200615457906").value=document.all("922200615457906").value.replace(/<br \/>/g,"");window.clipboardData.setData("Text",document.all("922200615457906").value);'>Copy to Clipboard</BUTTON><textarea style="position:absolute;visibility:hidden" name="922200615457906" wrap="virtual">
Function CountColors(LookupColor As Range, ColorLookupRange As Range, _
LookupValue, ValueLookupRange As Range)
Dim c As Range
Dim ColorIndex As Variant
Dim cIndex As Long
ColorIndex = LookupColor.Interior.ColorIndex
For Each c In ValueLookupRange
cIndex = cIndex + 1
If c.Value = LookupValue Then
If ColorLookupRange(cIndex).Interior.ColorIndex = ColorIndex Then
CountColors = CountColors + 1
End If
End If
Next c
End Function</textarea>