ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check for text within cells and make bold (https://www.excelbanter.com/excel-programming/293352-check-text-within-cells-make-bold.html)

TroyB[_2_]

Check for text within cells and make bold
 
Hi,

Is it possible to check the text within a group of cells (each cell contains
a full sentence) and if the words "PROVISIONAL SUM" are in a cell, then make
only the text "PROVISIONAL SUM" bold.
eg A3 = Supply and install conduits for power cable beneath proposed roads
and existing trees (PROVISIONAL SUM)

Thanks
Troy






Frank Kabel

Check for text within cells and make bold
 
Hi Troy
try the following macro (processes the current selection):

Sub foo()
Dim rng As Range
Dim cell As Range
Dim start_str As Integer

Set rng = Selection
For Each cell In rng
start_str = InStr(cell.Value, "PROVISIONAL SUM")
If start_str Then
cell.Characters(start_str, 15).Font.Bold = True
End If
Next
End Sub


--
Regards
Frank Kabel
Frankfurt, Germany

TroyB wrote:
Hi,

Is it possible to check the text within a group of cells (each cell
contains a full sentence) and if the words "PROVISIONAL SUM" are in a
cell, then make only the text "PROVISIONAL SUM" bold.
eg A3 = Supply and install conduits for power cable beneath proposed
roads and existing trees (PROVISIONAL SUM)

Thanks
Troy




All times are GMT +1. The time now is 01:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com