Solved How do I edit a script to color a single word?

January 19, 2017 at 15:21:13
Specs: Windows 10
Example of my macro script: I need the key word "smell" to be another color. Currently the script highlights the cell that "smell" is found in.

Sub KeyWordSearch()
'
' KeyWord Macro
'

'
With Application.ReplaceFormat.Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight2
.TintAndShade = 0.399945066682943
.PatternTintAndShade = 0
End With
Cells.Replace What:="smell", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=True
End Sub

message edited by JLaub


See More: How do I edit a script to color a single word?

Report •

#1
January 19, 2017 at 20:11:39
Will the word "smell" ever appear more than once in the same cell?

Will there be any words that contain the letters s-m-e-l-l, such as "smells", "outsmelling", etc?

Is Smell and SMELL the same word as smell?

How should any of the situations above be handled?

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

message edited by DerbyDad03


Report •

#2
January 20, 2017 at 07:50:56
Will the word "smell" ever appear more than once in the same cell? Not likely

Will there be any words that contain the letters s-m-e-l-l, such as "smells", "outsmelling", etc? Is Smell and SMELL the same word as smell?

My current macro contains about 288 key words (English and French) all of which are found when running the macro and it captures all forms of the word (It picks up any word that contains the pattern of letters SMEL or SMELL.. I have tested this.

Is there a way to edit my script to either BOLD the key word or change the COLOR so that it stands out more when reviewing Excel Exports?


Report •

#3
January 20, 2017 at 09:20:46
✔ Best Answer
Take a look at the code in Responses 2 & 3 of this thread:

https://www.computing.net/answers/o...

They will need some editing as far as Sheet names, Range names, etc. but I believe that one or the other (or both) is what you are looking for.

I tested the code in Response #2 but not #3.


Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

message edited by DerbyDad03


Report •

Related Solutions

#4
January 20, 2017 at 10:27:49
Thank you! I appreciate it.

Report •

Ask Question