Bold/Red a specific word in a cell

SinnaminGrrl

Board Regular
Joined
Feb 21, 2006
Messages
65
Hello:

My Column D contains many words in many rows. I would like to add in either VB or Conditional Formatting that would change the specific word "Update" to Bold and Red when it is typed anywhere in that column.

Thanks!
Nikki
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Is that the only word in the cell or will other words appear with it?
 
Upvote 0
Hi

Hopefully this should work. Copy the code into the relevant worksheet module

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    Dim myword As String
    Dim i As Integer
    Dim n As Integer
   
    myword = "update"
    
    If Not Intersect(Target, Range("D:D")) Is Nothing Then
    
        If InStr(Target, myword) > 0 Then
        
            myarray = Split(Target, myword)
            mycount = UBound(myarray)
            
            'Start search at position 1. (Allows for multiple occurrences)
            i = 1
            For n = 1 To mycount
                i = InStr(i, Target, myword)
                    Target.Characters(i, 6).Font.Color = vbRed
                    Target.Characters(i, 6).Font.Bold = True
                'start next search after previous
                i = i + Len(myword)
            Next
        End If
        
    End If


End Sub

atb
sumuwin
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,729
Members
449,049
Latest member
MiguekHeka

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