ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Macros to bold specified text in Excel (https://www.excelbanter.com/excel-programming/292915-re-using-macros-bold-specified-text-excel.html)

Andy Pope

Using Macros to bold specified text in Excel
 
Hi,

This routine will search the current selection for the specified text.

Sub MakeEntryBold()
Dim objCell As Range
Dim strSubString As String
Dim intPos As Integer
strSubString = _
InputBox("Enter text to make bold", "Make Entry Bold")
If strSubString < "" Then
For Each objCell In Selection
intPos = InStr(objCell.Value, strSubString)
If intPos 0 Then
objCell.Characters(intPos, Len(strSubString)) _
..Font.Bold = True
End If
Next
End If
End Sub


Need Help wrote:

I am trying to create a macro that searches a column for specified text and Bolds or Highlights all instances.

This is easy in Word but I couldn't find the feature in EXCEL.

Thanks.


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info


JulieD

Using Macros to bold specified text in Excel
 
Hi Andy

i stand corrected - thanks, very useful bit of code

cheers
JulieD
"Andy Pope" wrote in message
...
Hi,

This routine will search the current selection for the specified text.

Sub MakeEntryBold()
Dim objCell As Range
Dim strSubString As String
Dim intPos As Integer
strSubString = _
InputBox("Enter text to make bold", "Make Entry Bold")
If strSubString < "" Then
For Each objCell In Selection
intPos = InStr(objCell.Value, strSubString)
If intPos 0 Then
objCell.Characters(intPos, Len(strSubString)) _
.Font.Bold = True
End If
Next
End If
End Sub


Need Help wrote:

I am trying to create a macro that searches a column for specified text

and Bolds or Highlights all instances.

This is easy in Word but I couldn't find the feature in EXCEL.

Thanks.


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info





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

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