Option Explicit
Sub Format_Characters_In_Found_Cell()
Dim Found As Range, x As String, FoundFirst As Range
x = "over"
On Error Resume Next
Set Found = Cells.Find(what:=x, LookIn:=xlValues, LookAt:=xlPart)
If Not Found Is Nothing Then
Set FoundFirst = Found
Do
'Format from "x" to the end of the cell
Found.Characters(Start:=InStr(1, Found.Text, x), Length:=Len(Found)).Font.ColorIndex = 5
Set Found = Cells.FindNext(Found)
Loop Until FoundFirst.Address = Found.Address
Else
MsgBox x & " could not be found.", , " "
End If
End Sub
---------------------
What:="*a*b*" // provided a start 1st follow by keyword b
References
http://www.excel-vba-easy.com/vba-programming-string-manipulation.html
http://www.pcreview.co.uk/forums/find-function-t2215904.html
http://www.mrexcel.com/forum/showthread.php?t=576407
0 comments:
Post a Comment