Text formatting within a cell for the entire column

techie2013

New Member
Joined
Aug 8, 2013
Messages
34
I have a column with some text in each of its cell.

The string "Notes:" is occurring once or multiple times in each cell.

I would like to find all occurrences of this string in each cell throughout the column and either make it bold or underlined.





This is how the text looks now:


"There will be a screen with many controls.
Note: See the document referenced.in the above section.
Note: See the technical design document"


Any help would be highly appreciated.


Thanks
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Code:
Sub Macro3()
LR = Cells(Rows.Count, "A").End(xlUp).Row
For j = 1 To LR
  s = Range("A" & j).Text
  p = InStr(s, "Note")
  If p > 0 Then Range("A" & j).Characters(p, 4).Font.Bold = True
Next
End Sub
 
Upvote 0
Hi, techie2013,

if the text you posted is located within one cell the code may look something like
Code:
Sub MREX726636()
Dim lngRowCount As Long
Dim lngItemFound As Long
Dim strCellText As String
Dim lngStart As Long

For lngRowCount = 1 To Cells(Rows.Count, "A").End(xlUp).Row
  lngStart = 1
  strCellText = Range("A" & lngRowCount).Text
  Do While InStr(lngStart, strCellText, "Note") > 0
    lngItemFound = InStr(lngStart, strCellText, "Note")
    Range("A" & lngRowCount).Characters(lngItemFound, 4).Font.Bold = True
    lngStart = lngStart + lngItemFound + 4
  Loop
Next lngRowCount
End Sub
Ciao,
Holger
 
Upvote 0

Forum statistics

Threads
1,223,270
Messages
6,171,103
Members
452,379
Latest member
IainTru

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