Sub test()
With ActiveCell.Characters(Start:=WorksheetFunction.Find("must", ActiveCell), Length:=4).Font
.Underline = xlUnderlineStyleSingle
.Color = -16776961
End With
End Sub
Excel 2007 | |||
---|---|---|---|
A | |||
1 | I would like to make the word "must" wherever it is in any cell both red and underlined. | ||
2 | make the word mustard wherever | ||
3 | make the word is not here | ||
4 | make the word "must" wherever | ||
5 | we must stop here | ||
6 | |||
Sheet1 |
Excel 2007 | |||
---|---|---|---|
A | |||
1 | I would like to make the word "must" wherever it is in any cell both red and underlined. | ||
2 | make the word mustard wherever | ||
3 | make the word is not here | ||
4 | make the word "must" wherever | ||
5 | we must stop here | ||
6 | |||
Sheet1 |
Sub ColorUnderlineWord()
' hiker95, 06/03/2015, ME859072
Dim c As Range
For Each c In Range("A1", Range("A" & Rows.Count).End(xlUp))
If InStr(c, "must") Then
With c.Characters(Start:=WorksheetFunction.Find("must", c), Length:=4).Font
.Underline = xlUnderlineStyleSingle
.Color = vbRed
End With
End If
Next c
End Sub
Thanks! Much appreciated.