View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.misc
mopgcw mopgcw is offline
external usenet poster
 
Posts: 18
Default 2 different formats of text in a single cell?

David & Rick

THANKS, this was VERY helpful.

That's why this is such a great forum.

Take care,
George


"Rick Rothstein" wrote:

Enter the text "Some bold and red words" in A1 and then give this code a
try...

Sub Test()
Dim R As Range
Dim Word As String
Dim Position As Long
Set R = Range("A1")
' Clear any exiting font formatting
R.Characters.Font.Bold = False
R.Characters.Font.ColorIndex = xlAutomatic
' Make a word bold
Word = "Bold"
Position = InStr(1, R.Value, Word, vbTextCompare)
R.Characters(Position, Len(Word)).Font.Bold = True
' Make the color of a word red
Word = "red"
Position = InStr(1, R.Value, Word, vbTextCompare)
R.Characters(Position, Len(Word)).Font.ColorIndex = 3
End Sub

--
Rick (MVP - Excel)


"David Biddulph" <groups [at] biddulph.org.uk wrote in message
...
If your text constant is abcdefghj, in the formula bar select the def,
then Format Cells will give you a font tab. Select the desired
formatting, and that will be applied to the def.
--
David Biddulph

"mopgcw" wrote in message
...
Thanks, how would I format part of a text constant?



"Rick Rothstein" wrote:

You can't bold or italicize (or do any other font formatting to) part of
a
string of text if that text is displayed as the result of a worksheet
formula... only text constants can have parts of its text formatted
differently from the rest.

--
Rick (MVP - Excel)


"mopgcw" wrote in message
...
Is it possible to have more than one format for a text string in a
cell?

For example, I have the formula:

=i_currency&TEXT(+$C$13/landarea,"#,###.##")&"/"&landunit,"")

How can I bold or italicize part of the text string?

thanks
George