View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jérémie Gent Jérémie Gent is offline
external usenet poster
 
Posts: 18
Default Different Styles within a single Cell

Thanks!

I noticed following behaviour though:
If I concatenate a string to the value of the cell, then the formatings of
the characters aren't kept.
For example, if I have AB with the B in blue like in your code Gary, then as
soon as I do something like
cells(1,1).value=cells(1,1).value & "C"
then the whole text ABC is in blue

Just as Information, doesn't bother me though.
I changed my procedure to generate first the whole text content of the cell,
then the formatting inside.
It works fine now.

Cheers
Jérémie


"Gary''s Student" schrieb im
Newsbeitrag ...
Sub gsnu()
Cells(1, 1) = "AB"
Cells(1, 1).Characters(Start:=1, Length:=1).Font.ColorIndex = 32
End Sub

will paint the first character blue. By specifying start and length each,
character can be assigned a different style
--
Gary's Student


"Jérémie Gent" wrote:

Hi!

I would like a vb function to set a value into a cell, as well as
different
styles within this cell.
For example, I would like to have in cells(1,1) the value "AB" where A
would
be normal, and B would B bold (or another Font, another color, etc)
How do I do that from VB ?

Thanks!