any help.
Thanks in advance
Now Paste the code above into the module. Close the VBE, go back to your worksheet and press shift-f9 to recalc.
Incidentally, changing the font colours after the formula's been entered will not inspire Excel to recalc., you need to either make a cell entry or do a manual recalc.
Thanks a lot
Is there a way that I can send you my small file for kind review.
Thanks
Try placing the following function in a normal module in your workbook:
Function CountByColor(InputRange As Range, ColorRange As Range) As Long
Dim cl As Range, TmpCount As Long, ColorIndex As Integer
Application.Volatile
ColorIndex = ColorRange.Font.ColorIndex
TmpCount = 0
On Error Resume Next
For Each cl In InputRange.Cells
If cl.Font.ColorIndex = ColorIndex _
Then TmpCount = TmpCount + 1
Next cl
CountByColor = TmpCount
End Function
Now use the following following formula:
=CountByColor(A1:C5,D1)
Where a1:d6 is the range that holds the cells you're counting and F1 is a cell that has text with the targeted font colour. I'll follow up with a visual, my message is too long...
Here's a visual aid:
| |||||||
| |||||||
| |||||||
| 1 | 7 | 8 | My Colour | ||||
| 2 | 8 | 9 | 4 | ||||
| 3 | 9 | 10 | |||||
| 4 | 10 | 11 | |||||
| 5 | 11 | 12 | |||||
| |||||||
[HtmlMaker 2.20BETA] To see the formula in the cells just click on the cells hyperlink or click the Name box
PLEASE DO NOT QUOTE THIS TABLE IMAGE ON SAME PAGE! OTHEWISE, ERROR OF JavaScript OCCUR.
You can click on F2 to see the formula. Hope this helps.
#If you have any other info about this subject , Please add it free.# |