How to bold partial text string for over 600 rows

Jongo1

New Member
Joined
Aug 8, 2016
Messages
24
I have in column B non-duplicate information and I need to bold over 600 lines in the manner below.

WGHI(Studio)(Los Angeles, Cali) Radio (Nov 1, 2017) - Top 10 Radio Station
KAWG (CNBC)(NY, New York) Television (Nov 2, 2017) - Top 10 TV

and so on and so on for 600 rows what I need is

WGHI(Studio)(Los Angeles, Cali) Radio (Nov 1, 2017) - Top 10 radio station
KAWG (CNBC)(NY, New York) Television (Nov 2, 2017) - Top 5 TV

is this possible?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
If your rows always contain at least 3 parens ((( and you want it to bold everything up to the 3rd open paren, then the following will work. Run the doboldstring macro.

Code:
Option Explicit
Function Meds(S As String) As String
    Dim S1 As Variant, S2 As Variant


S1 = Split(S, "\")
S2 = Split(S1(UBound(S1)), "(")
ReDim Preserve S2(0 To 2)
Meds = Join(S2, "-")


End Function
Sub doboldstring()
Dim lastrow, x, parens, strlen As Long


lastrow = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
For x = 1 To lastrow
parens = UBound(Split(Cells(x, "B"), "("))
If parens >= 3 Then
strlen = Len(Meds(Cells(x, "B")))
With Cells(x, "B").Characters(Start:=1, Length:=strlen).Font
                .FontStyle = "Bold"
    End With
End If
Next x
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,992
Messages
6,175,826
Members
452,673
Latest member
LaMiaAvy

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