How to highlight or change the format of a single word in an excel file

jinujk

Reputable
Apr 1, 2014
8
0
4,510
I am having a 100 column spreadsheet with different sentences. I want to highlight the similar words or change the color of the repeating words. is there any formula or vb code which will help me to find the solution.
 
Solution


Found this. Have not tried it, so don't know if it actually works.

http://windowssecrets.com/forums/showthread.php/146908-Highlighting-one-word-in-a-cell

Sub HighlightStrings()
Application.ScreenUpdating = False
Dim Rng As Range, StrFnd As String, StrTmp As String, i As Long, j As Long, x As Long
StrFnd = InputBox("What is the string to highlight", "Highlighter")
x = Len(StrFnd)
For Each Rng In Selection
With Rng
j = UBound(Split(Rng.Value, StrFnd))
If j > 0 Then
StrTmp = ""
For i = 0 To j - 1...

Caldrumr

Distinguished
Jun 5, 2011
112
0
18,690
From the Home tab in Excel, under Styles, click Conditional Formatting. Select New Rule, and click on Format Only Unique or Duplicate Values. From the Format All menu, select Duplicate from the drop-down menu, and click Format to select formatting.
This will allow you to format duplicate values automatically.

If you want different formatting for specific cells, click Format Only Cells that Contain, and select formatting for your choice of results.

I hope that helps.



 

jinujk

Reputable
Apr 1, 2014
8
0
4,510
for eg: I have three cells with data : hp server, hp switch, dell server. I need to make "hp" bold or change the color since it is common. I dont want to highlight the entire cell. is it possbile?



 

jinujk

Reputable
Apr 1, 2014
8
0
4,510
Tnx..Do you have one.. I searched but no luck.



 

USAFRet

Titan
Moderator


Found this. Have not tried it, so don't know if it actually works.

http://windowssecrets.com/forums/showthread.php/146908-Highlighting-one-word-in-a-cell

Sub HighlightStrings()
Application.ScreenUpdating = False
Dim Rng As Range, StrFnd As String, StrTmp As String, i As Long, j As Long, x As Long
StrFnd = InputBox("What is the string to highlight", "Highlighter")
x = Len(StrFnd)
For Each Rng In Selection
With Rng
j = UBound(Split(Rng.Value, StrFnd))
If j > 0 Then
StrTmp = ""
For i = 0 To j - 1
StrTmp = StrTmp & Split(Rng.Value, StrFnd)(i)
.Characters(Start:=Len(StrTmp) + 1, Length:=x).Font.ColorIndex = 3
StrTmp = StrTmp & StrFnd
Next
End If
End With
Next Rng
Application.ScreenUpdating = True
End Sub
 
Solution