Bold one word in a cell not the entire cell

ielamrani

Board Regular
Joined
Jun 2, 2008
Messages
63
Hi,
This piece of code bold the entire cell, I am trying to make it bold only the words: Owner and Beneficiary. I tried different ways in vain. Please let me know if you know the answer. Thanks in advance.

Code:

RptWks.Cells(oRow,"A").Value _
= "Owner: " & .Cells(iRow, "A").Value

RptWks.Cells(oRow,"A").Font.Bold = True

oRow = oRow + 1
RptWks.Cells(oRow,"A").Value _
= "Beneficiary: " & .Cells(iRow, "B").Value

RptWks.Cells(oRow,"A").Font.Bold = True
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

jindon

MrExcel MVP
Joined
Aug 21, 2004
Messages
16,995
try
Code:
With RptWks.Cells(oRow,"A")
    .Font.Bold = False
    .Value = "Owner: " & .Cells(iRow, "A").Value
    .Characters(1, 5).Font.Bold = True
End With
 
oRow = oRow + 1
With RptWks.Cells(oRow,"A")
    .Font.Bold = False
    .Value = "Beneficiary: " & .Cells(iRow, "B").Value
    .Characters(1, 11).Font.Bold = True
End With
 

pbornemeier

Well-known Member
Joined
May 24, 2005
Messages
3,896
Try this:

RptWks.Cells(oRow, "A").Value _
= "Owner: " & .Cells(iRow, "A").Value

RptWks.Cells(oRow, "A").Characters(Start:=1, Length:=11).Font.FontStyle = "Bold"

oRow = oRow + 1
RptWks.Cells(oRow, "A").Value _
= "Beneficiary: " & .Cells(iRow, "B").Value

RptWks.Cells(oRow, "A").Characters(Start:=1, Length:=11).font.FontStyle = "Bold"
 

ielamrani

Board Regular
Joined
Jun 2, 2008
Messages
63
Hi guys,
I tried both.
Jindon, your code does not like the word Characters. It highlights it.

Bbornemeier,

Yours works with a slight change instead of 11 for Owner it's 5. I am sure it's a typo.

RptWks.Cells(oRow, "A").Characters(Start:=1, Length:=5).Font.FontStyle = "Bold"

Thank you so much guys.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,038
Messages
5,856,973
Members
431,843
Latest member
Malahhai

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top