Archive of Mr Excel Message Board
Back to Forms in Excel VBA archive index
Back to archive home
Colour textPosted by Pete on December 06, 2001 3:57 AM
Ok if i have a formula that i wish to have part the answr in red not black text any way ti do this please
Say ="Today is : " & NOW() i would like the date in red??
Anyone know, please
Format the cell text as redPosted by Paul on December 06, 2001 4:05 AM
Re: Format the cell text as redPosted by Pete on December 06, 2001 4:08 AM
thats teh point dont work i only want PART the answer in red as i described formatting " RED will make all red, i cant seem to get format font to red in PART of the selection??
Im lost on this one..
Re: Colour textPosted by Bruno on December 06, 2001 4:48 AM
pete, I don't think it's possible to format a cell with a function...
Can't you split the formula ?
for example :
cell a1 : Today is :
cell b1 : Now()
Now you can format B1 as red
To format characters separately in same cell...Posted by Tom Urtis on December 06, 2001 5:03 AM
You say you want to have the text "Today is" in black and the date in red. Assuming your date is in mm/dd/yy format (8 characters), then invoke this code:
.Font.ColorIndex = 3
(ActiveCell.Characters.Count - 8)) _
.Font.ColorIndex = 1
If your date format is other than 8 characters, change the numeral 8 in the code to however many characters your date is formatted to be.
As you can probably tell, the second With structure statement is broken out onto 3 lines for easier readability here; it can go onto 1 line in your actual module for easier readability there.
Re: To format characters separately in same cell...Posted by Jack on December 06, 2001 7:07 AM
Good stuff. ill give it a spin, guess by function will be impossible, shame but VBA gets arround that so im very happy, cheers!
This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store
to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.