excel怎麼把單元格內某個字標紅,其餘字不變

alt+F11,打開宏編輯器運行以下代碼:編輯器

Sub AAA()

    Dim R As Range, L As Long, S As String

    Application.ScreenUpdating = False

    S = "紅"  '要標記的字符

    L = Len(S)

    For Each R In Selection

        If InStr(R, S) > 0 Then R.Characters(InStr(R, S), L).Font.Color = vbRed

    Next

    Application.ScreenUpdating = True

End Sub
相關文章
相關標籤/搜索