View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
sali[_2_] sali[_2_] is offline
external usenet poster
 
Posts: 24
Default can we color a cell content partly?

"J_J" wrote in message
...
Hi,
My question may look like a simple one but here it goes:

combining cell contents via formulas such as
C10=A20&" ("&B40&")"
is simple and straight forward enough.

But can I manage to display cell B40 contents using a different color (say
red) then cell A20 content in C10 programmatically?. In target cell C10
where cells A20 and B40 contents are to be merged I need to see cell A20
contents in default color, but cell B40 contents in red.
An example will be much appreciated.
TIA
J_J


this will change appearance of characters [1..3] and [4..5] in cell.
you just need to take care where starts the characters from each merged
cells

With ActiveCell.Characters(Start:=1, Length:=3).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.ColorIndex = 1
End With
With ActiveCell.Characters(Start:=4, Length:=2).Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.ColorIndex = 3
End With