Not true. Your isnull test determines the need to loop or not. If it is
null, you loop. No difference there in approaches except the extra test.
If it isn't null, you check the font color of the range. In that case, my
checking the first character would stop the loop just as easily with no
additional looping..
For Each rCell In rRange.Cells
With rCell
For i = 1 To Len(.Value)
If .Characters(i, 1).Font.ColorIndex = iColor Then
n = n + 1
Exit For
End If
End If
End With
Next
Should be just as effective. No looping through xlautomatic except in the
same situations your original code. would. loop.
--
Regards,
Tom Ogilvy
"keepITcool" wrote in message
. com...
Tom,
Not true. The null test is there to avoid the loop
when the cell(not partial text) is formatted.
in a likely scenario most cells will have
CELL.font.colorindex = xlAutomatic
and your code must loop all characters to find out.
--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam
Tom Ogilvy wrote :
You could ignore the Null test and just jump out when the first
matching color is found (as I suggested in my earlier answer). It
would work in either case.
ActiveCell.Font.ColorIndex = 41
? ActiveCell.Characters(1,1).Font.ColorIndex
41