How set a format on one of more strings in a concatination

S

Steen

Hi
Can anyone help me with the following problem:

A B C
HeadLine Description Bold(Headline)
Description

I have found the first part of the solution elsewere on the site:
C1 = A1 & Char(10) & B1

But how do I set the Headline in Bold and not the description in C1 - is it
possible?
 
D

Don Guillett

You can't in a formula. You will need to convert to a string and then you
can bold part of it.
 
S

Steen

Any chance that you know how to do the task with converting it to a string
and make the headline bold?
 
D

Don Guillett

if it is a string like
xxxxyyyyzzzz
then just place your cursor in the FORMULA BOX and highlight what you want
to change. This can be done with a macro using

Characters Property
See Also Applies To Example Specifics
Returns a Characters object that represents a range of characters within the
object text. You can use the Characters object to format characters within a
text string.

expression.Characters(Start, Length)
 
S

Steen

Thanks Don, but I am sorry to say but I don't fully understand what you are
writing concerning using the Characters Property, could you please give an
example?

A B C
HeadLine1 Decription1 HeadLine+Desc1 C1= (BOLD(A1)&char(10)&B1
HeadLine2 Decription2 HeadLine+Desc2 C2= (BOLD(A2)&char(10)&B2
HeadLine3 Decription3 HeadLine+Desc3 C3= (BOLD(A3)&char(10)&B3
....
 
D

Don Guillett

I thought I said that it must first be converted to a string before you can
bold part manually or with a macro using the characters property. I did give
an example or you may, as I did, goto the vba help index and type in
characters
 
G

Gord Dibben

Steen

Example only.

Sub CellFont()
With ActiveCell.Characters(Start:=1, length:=5).Font
.ColorIndex = 3
.Bold = True
.Underline = True
.Size = 14
End With
With ActiveCell.Characters(Start:=6, length:=3).Font
.Superscript = True
.ColorIndex = 5
End With
End Sub


Gord Dibben MS Excel MVP
 

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