i would like to find a text between 2 characters and format that text only example : cell a1 = hello ! this is the test ! sentance i want to change only the part between the exclamation marks.
Sub Macro2()
Dim varFound As Variant, varSearch As Variant
Dim strAddress As String, intPos As Integer
varSearch = "!*!"
Set varFound = Cells.Find(varSearch, LookIn:=xlValues, LookAt:=xlPart)
If Not varFound Is Nothing Then
strAddress = varFound.Address
Do
With varFound
Do
intPos = InStr(intPos + 1, .Value, varSearch, vbTextCompare)
If intPos Then
.Characters(Start:=intPos, Length:=Len(varSearch)).Font.FontStyle = "Bold"
.Characters(Start:=intPos, Length:=Len(varSearch)).Font.ColorIndex = 3
End If
Loop Until intPos = 0
End With
Set varFound = Cells.FindNext(varFound)
Loop While Not varFound Is Nothing And _
varFound.Address <> strAddress
End If
End Sub
`