Change font color and style

Jeff P

Board Regular
Joined
Jun 11, 2011
Messages
80
Hello,

I came across this code which changes the Font color for individual names within a Range.
How can i also include the functionality to change the font Name, Style Size and Boldness for each individually?

Thanks for any help!

HTML:
Sub Change_FontColor()

Set MyPlage = Range("NamesList")
    Application.ScreenUpdating = False
    For Each cell In MyPlage
        Select Case cell.Value

Case Is = "Alex"
cell.Offset(0, 0).Font.ColorIndex = 32
Case Is = "Demitri"
cell.Offset(0, 0).Font.ColorIndex = 26
Case Is = "Philip"
cell.Offset(0, 0).Font.ColorIndex = 43

 Case Else      
            cell.Offset(0, 0).Font.ColorIndex = xlNone      
        End Select
    Next
    Application.ScreenUpdating = True

End Sub
 
Last edited:

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Code:
Sub Change_FontColor()


Set MyPlage = Range("NamesList")
    Application.ScreenUpdating = False
    For Each cell In MyPlage
        Select Case cell.Value


Case Is = "Alex"
cell.Offset(0, 0).Font.ColorIndex = 32
cell.Offset(0, 0).Font.Size = 12 'change as needed
cell.Offset(0, 0).Font.Bold = True
Case Is = "Demitri"
cell.Offset(0, 0).Font.ColorIndex = 26
cell.Offset(0, 0).Font.Size = 12 'change as needed
cell.Offset(0, 0).Font.Bold = True
Case Is = "Philip"
cell.Offset(0, 0).Font.ColorIndex = 43
cell.Offset(0, 0).Font.Size = 12 'change as needed
cell.Offset(0, 0).Font.Bold = True


 Case Else
            cell.Offset(0, 0).Font.ColorIndex = xlNone
        End Select
    Next
    Application.ScreenUpdating = True


End Sub
 
Upvote 0

Forum statistics

Threads
1,224,814
Messages
6,181,128
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top