Color text inserted into other text

J

jasminesy

is it possible to color code text that will be inserted into other text:

asdf="HI"
if Range("a1")<>"" then
tempval=Range("a1").value
Range("a1").ClearContents
Range("A1")=tempval & asdf


but I want "asdf" to be red (existing as is)???
Is there anyway to do that other than inserting it, searching it and then
color coding it??????
 
J

JLGWhiz

I think you would do it something like this:


Sub dk()
asdf = "Hi"
tempVal = Range("A1").Value & asdf
Range("A1") = tempVal
Range("A1").Characters(Len(tempVal) + 1 - Len(asdf), _
Len(asdf)).Font.ColorIndex = 3
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top