View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default font color of partial cell contents

jim:

do you know why when i add the line feed it resets the colors?

.Value = .Value & Chr(10) & strName

i put 2 names on a line
as soon as this line executes, the orginal colors change of the 2 names change
to the color of the first listed name.
--


Gary


"Jim Cone" wrote in message
...
Adds "Gary" to the end of the existing text in cell B5
and colors it Red. The existing text color is not affected...
'--
Sub JustATest()
Dim strCell As String
Dim strName As String
Dim lngCellLength As Long

strCell = Range("B5").Text
lngCellLength = Len(strCell)

strName = "Gary"
strName = strCell & strName

Range("B5").Value = strName
Range("B5").Characters(lngCellLength + 1, 255).Font.ColorIndex = 3
End Sub
----------
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"Gary Keramidas"
<GKeramidasATmsn.com
wrote in message
i was playing with that before i posted, but couldn't figure out how to only
apply it to the value i am adding to the cell. i may be able to test for upper
case characters and do that, but i was trying to apply it as soon as i place
the
value in the cell.
would this work?

i will know the length of the what i am adding. so maybe using the right
function? not sure how to proceed.
--
Gary


"Jim Cone"
wrote in message
Hi Gary,
Take a look at the Characters property for the Range object
and also the Characters object.
If you know the length of the text then it's no problem.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Gary Keramidas" <GKeramidasATmsn.com
wrote in message
let's say i have a variable called fname (first name)
i want to write that value to a cell and make the font color red. but, there
could already be an fname in the cell, or there could be one added after this
one.
how would i code it to make that particular value appear in red?
--
Gary