Re: count occurences of font color
- From: "Tom Ogilvy" <twogilvy@xxxxxxx>
- Date: Fri, 3 Feb 2006 22:56:39 -0500
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" <xrrcvgpbby@xxxxxxxxx> wrote in message
news:xn0ei1xrjjhyd5001keepitcoolnl@xxxxxxxxxxxxxxxxxxxxx
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
.
- Follow-Ups:
- Re: count occurences of font color
- From: keepITcool
- Re: count occurences of font color
- References:
- Re: count occurences of font color
- From: keepITcool
- Re: count occurences of font color
- From: Tom Ogilvy
- Re: count occurences of font color
- From: keepITcool
- Re: count occurences of font color
- Prev by Date: Re: Calling Sub difficulty
- Next by Date: Re: Calling a Sub from another
- Previous by thread: Re: count occurences of font color
- Next by thread: Re: count occurences of font color
- Index(es):
Relevant Pages
|
Loading