ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Color text inserted into other text (https://www.excelbanter.com/excel-programming/428161-color-text-inserted-into-other-text.html)

jasminesy

Color text inserted into other text
 
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??????

JLGWhiz[_2_]

Color text inserted into other text
 
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




"jasminesy" wrote in message
...
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??????





All times are GMT +1. The time now is 01:50 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com