Excel 改变指定字符颜色

Sub changeColor()
    For i = 1 To Range("B65536").End(xlUp).Row
        temp = Cells(1, 3)
        Cells(i, 2).Select
        a = InStr(1, Cells(i, 2), temp)
        ActiveCell.Font.ColorIndex = 1
        If a > 0 Then
            ActiveCell.Characters(Start:=a, Length:=2).Font.ColorIndex = 7
        End If

    Next
End Sub


猜你喜欢

转载自zyfromcq.iteye.com/blog/1882797