Format individual characters within a formula

D

Daner

It's easy to change the font format of individual characters within
cell if that cell contains regular data, but if that cell contains
FORMULA, it's not that easy. All I'm trying to do is concatenate som
UNFORMATTED dynamic text with some FORMATTED static text formatted. Fo
example:

=A3&"string1"

where "string1" is bold but the text from A3 is not. Is there any wa
to do this? I can't believe there is no FONTFORMAT() formula o
anything like that.

Thanks for your hel
 
J

JE McGimpsey

There are no XL functions that can do that. Worksheet functions can only
return values to their calling cells, not affect formatting.

This can be done with VBA. Put this in your worksheet code module
(right-click on the worksheet tab and choose View Code):

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Application.EnableEvents = False
With Range("A4")
.Value = Range("A3").Text & "string1"
.Characters(Len(Range("A3").Text) + 1).Font.Bold = True
End With
Application.EnableEvents = True
End Sub


Change A4 to your desired cell. Note that it updates each time a
calculation occurs.
 

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