PDA

View Full Version : Solved: Font color for string



vzachin
11-21-2007, 12:56 PM
Hi,

I have a cell B6 that may contain a maximum of 420 characters. I want the font color of every 71st character to be red.
I've tried something like this:

Range(Mid("B6"), 71, 1).Font.ColorIndex = 3


but of course this doesn't work.

how can i code this properly?


thanks
zach

RichardSchollar
11-21-2007, 01:02 PM
Hi Zach

You'll need something like the following:


Sub red71()
Dim i As Long
For i = 71 To Len(ActiveCell.Value) Step 71
ActiveCell.Characters(i, 1).Font.Color = vbRed
Next
End Sub

Richard

vzachin
11-21-2007, 01:15 PM
Hi Richard,

Very Nice. Thanks.

zach