View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
ND Pard ND Pard is offline
external usenet poster
 
Posts: 73
Default Change color of characters in a cell based of a cell reference

The following subprocedure (macro) will color the charactacters in column A,
beginning with cell A1 and going down until the value in column A is less
than " ", to the desired colors Red and Blue based on the column A's
respective values in columns B and C:

Sub Chg_Colors()
Range("A1").Select

Do While ActiveCell.Value " "
ActiveCell.Characters(Start:=1, _
Length:=ActiveCell.Offset(0, 1).Value).Font.Color = -16777024
ActiveCell.Characters(Start:=ActiveCell.Offset(0, 1).Value + 1, _
Length:=ActiveCell.Offset(0, 2).Value).Font.Color = -10477568
ActiveCell.Offset(1).Select
Loop
End Sub

Good Luck.

"kimbobo" wrote:

Hi All,

Does anyone know how to change the color of characters in a cell based
of a cell reference.

For example, cell A1 = "||||||||||" (contains 10 "|") I want the first
4 "|" to be Red and the second 6 to Blue. Based of cells A2 = 4 and A3
= 6.

Any ideas?

Thanks!!

-Kim