Format a string before write to a cell

M

moonhk

Hi All
How to format a string before write to a cell ?
Trial Run Status , Remark and Reason for Stop Formatting are bold.

Also, how to underline ?

.....

'~~ Status ALL
GPD_Remark = ""

'~~ Trial Run Status
If Application.Selection.Range(GPD.STATUS_ADD
& ir).Value <> "" Then
GPD_Remark = "Trial Run Status:" & Chr(10)
& Application.Selection.Range(GPD.STATUS_ADD & ir).Value & Chr(10)
End If
'~~ Remark
If Application.Selection.Range(GPD.Remark_Add
& ir).Value <> "" Then
GPD_Remark = GPD_Remark & "Remark :" &
Chr(10) & Application.Selection.Range(GPD.Remark_Add & ir).Value &
Chr(10)
End If
'~~ Reason
If Application.Selection.Range(GPD.Reason_Add
& ir).Value <> "" Then
GPD_Remark = GPD_Remark & "Reason for Stop
Formatting :" & Chr(10) & Application.Selection.Range(GPD.Reason_Add &
ir).Value
End If

If GPD_Remark <> "" Then
.Range(MES.STATUS_ALL_ADD &
get_row(Rng_KEY.Address)).Value = GPD_Remark
End If
 
P

Per Jessen

You have to format the cell where you want to place the comment.

With Range("A1").Font
.Bold = True
.Underline = True
End With

Regards,
Per
 
M

moonhk

You have to format the cell where you want to place the comment.

With Range("A1").Font
    .Bold = True
    .Underline = True
End With

Regards,
Per

Hi All
Thank for you suggestion.
Not all text are bold. Just part of text are bold.
e.g.

Title is bold
Line 2 is normal
This line is bold
This line is normal.
 

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