Displaying alternate Words in BOLD in a Cell

NimishK

Well-known Member
Joined
Sep 4, 2015
Messages
688
Hi

I would like to Bold alternate words
for eg Name : MR.EXCEL Country : USA

Code:
Dim strName As String, strCountry As String, Dim mpStart As Long
    strName = "MR.EXCEL"
    strCountry = "USA"
    
With Worksheets("sheet5").Cells(14, 1)
          .Font.Bold = False
     .value = "Name : " & strName
     .value =  "Country : " & strCountry     '
     mpStart = InStr(.value, strName)
   If mpStart > 0 Then
     .Characters(mpStart, Len(strName)).Font.Bold = True
     .Characters(mpStart, Len(strCountry)).Font.Bold = True
      End If
 End With
I tried above only hiliting in bold is Mr. Excel and other remains without bold
MR.EXCEL and USA should be in bold
Thanks
NimishK
 
Last edited:

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Code:
Dim strName As String, strCountry As String
strName = "MR.EXCEL"
strCountry = "USA"
With Worksheets("sheet5").Cells(14, 1)
    .Font.Bold = False
    .Value = "Name : " & strName & " Country : " & strCountry
    .Characters(InStr(1, .Value, strName, 1), Len(strName)).Font.Bold = True
    .Characters(InStr(1, .Value, strCountry, 1), Len(strCountry)).Font.Bold = True
End With
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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
Back
Top