[英]Replace Text and Change font color
I'm stuck. 我被卡住了。 I was successfully able to replace 3 texts in a column to a specific text.
我成功地将一栏中的3个文本替换为特定的文本。 But am unable to change the font of the replaced texts to Red.
但是无法将替换文本的字体更改为红色。 Would appreciate help.
希望能有所帮助。 Thanks Following is the current code
感谢以下是当前代码
Worksheets("HPR").Columns("E").Replace _
What:="IM", Replacement:="Non-IM", _
SearchOrder:=xlByColumns, MatchCase:=True
Worksheets("HPR").Columns("E").Replace _
What:="Comp", Replacement:="Non-IM", _
SearchOrder:=xlByColumns, MatchCase:=True
Worksheets("HPR").Columns("E").Replace _
What:="", Replacement:="Non-IM", _
SearchOrder:=xlByColumns, MatchCase:=True"
Just add the below lines to the beginning of your code. 只需将以下几行添加到代码的开头即可。
With Application.ReplaceFormat.Font
.Subscript = False
.Color = 255
.TintAndShade = 0
End With
Now add the below line after all the MatchCase:=True,
现在,在所有
MatchCase:=True,
之后添加以下行MatchCase:=True,
ReplaceFormat:=True
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.