我想在2个字符之间找到一个文本,并且只能找到文本格式 例如: 单元格a1 =你好!这是考验!森泰斯 我想只改变感叹号之间的部分。
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
`