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

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
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,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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