0

how to write a macro for excel - it is necessary to select only those symbols that have a red color in one cell, increase them to 14 font, underline them and make them bold, and leave the other symbols in the same cell in black. Thank you.

Sub FormatSelectedCells()
    Dim cell As Range
    For Each cell In Selection
        If cell.Font.Color = RGB(255, 0, 0) Then
            cell.Font.Size = 14
            cell.Font.Bold = True
            cell.Font.Underline = True
        Else
            cell.Font.Color = RGB(0, 0, 0)
            cell.Font.Size = 11
            cell.Font.Bold = False
            cell.Font.Underline = False
        End If
    Next cell
End Sub

changes the entire cell

Sub IncreaseRedFont()
    Dim rng As Range
    Set rng = Selection
    For Each cel In rng
        If cel.Font.Color = RGB(255, 0, 0) Then
            cel.Font.Size = 14
            cel.Font.Bold = True
            cel.Font.Underline = xlUnderlineStyleSingle
        End If
    Next cel
End Sub

changes the entire cell

And it is necessary to change only one word, which is red

0 Answers0