View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default font color of partial cell contents

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