Formatting font with concantenated string

T

Todd

Hi,

I'm new to the visual basic world so please bare with
me. I have the following string:

="If Q1 revenue is equal to "&TEXT(A10,"$#,##0")&" then
everything is on track for fiscal 2004."

I would like to able to keep everything as is and change
only "Q1" to bold, blue font.

Any suggestions?

Thanks very much,
Todd
 
B

Bob Phillips

If it's a once-off, just select the Q1 part in the formula bar, and change
the font colour to blue.
 
V

Vasant Nanavati

Unfortunately, since your string is the result of a formula, I don't believe
this can be done.
 
J

J.E. McGimpsey

you can't apply character formatting to the result of a formula.
However, you could use an event macro.

Put this in the worksheet code module (right-click on the worksheet
tab and select View Code):

Private Sub Worksheet_Calculate()
With Range("B10")
.Value = "If Q1 revenue is equal to " & _
Format(Range("A10").Value, "$#,##0") & _
" then everything is on track for fiscal 2004."
With .Characters(4, 2).Font
.Bold = True
.ColorIndex = 5
End With
End With
End Sub

Change "B10" to suit
 
Top