0

I am trying to change the color of a range of cells ("A" to "N") depending on the value of a defined cell, in this case the value in cell "H". I need to change to white and bold for the cases "credentialing", "ci error/ticket"and "completed/backup" and the other cases keep it in regular black.

I have the code for changing the cell color on the defined range but I don't know how to apply the code for the font style and color to change. Here is what I have so far:

Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Columns("H")) Is Nothing Then
        On Error GoTo bm_Safe_Exit
        Application.EnableEvents = False
        Dim trgt As Range
        For Each trgt In Intersect(Target, Columns("H"))
            Select Case LCase(trgt.Value2)
            Case "2 day process"
                    Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 46
                    Case "advisor"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 37
                    Case "back in"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 22
                    Case "ci error/ticket"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 1
                    Case "completed"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 10
                    Case "completed/backup"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 51
                    Case "credentialing"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 49
                    Case "credit"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 44
                    Case "duplicate"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 10
                    Case "held"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 37
                    Case "master data"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 37
                    Case "name change"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 37
                    Case "ofr"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 3
                    Case "op consultant"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 37
                    Case "post process"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 32
                    Case "pps"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 37
                    Case "react acct"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 37
                    Case "rejected"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 10
                    Case "transferred"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 10
                    Case "zpnd"
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.ColorIndex = 37
                    Case Else
                        Cells(trgt.Row, "A").Resize(1, 14).Interior.Pattern = xlNone
            End Select
        Next trgt
    End If
bm_Safe_Exit:
    Application.EnableEvents = True
    End Sub
1

1 Answer 1

1

You have to access the Font property of the cells. So in your case

Cells(trgt.Row, "A").Resize(1, 14).Font.ColorIndex = 1
Cells(trgt.Row, "A").Resize(1, 14).Font.FontStyle = "Bold"
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your response. I applied the code to my worksheet on the cases listed on my question but is not changing the font properties on the desired range of cells. I tried something similar and it was changing the color, the problem was that when I changed the value or removed the value on cell "H" the font was still white and I need it to change to default

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.