用VBA改变单元格中固定字符的颜色
比如我们要将选中的单元格中的字符串"『一時団体情報』"改变为红色,执行以下操作即可。
Private Sub Button_Click()
cString = "『一時団体情報』"
nColor = 3
nLenth = Len(cString)
Set oRange = Selection
For Each oCell In oRange.Cells
i = 0
On Error Resume Next
i = Application.WorksheetFunction.Find(cString, oCell.Value)
If i > 0 Then
oCell.Characters(i, nLenth).Font.ColorIndex = nColor
End If
Next
End Sub