Results 1 to 3 of 3

Thread: Change font color and style
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Jun 2011
    Posts
    69
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Change font color and style

    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 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
    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 by Jeff P; Oct 19th, 2019 at 07:09 PM.

  2. #2
    Board Regular alansidman's Avatar
    Join Date
    Feb 2007
    Location
    Steamboat Springs
    Posts
    5,006
    Post Thanks / Like
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Change font color and style

    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
    Let me know if that works for you
    Alan

    Am Yisrael Chai

    Win 10--Office 2019
    When Posting Code, please use code tags.
    How to insert Mcode to Power Query https://excel.solutions/2017/11/powe...te-code-video/


  3. #3
    Board Regular
    Join Date
    Jun 2011
    Posts
    69
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Change font color and style

    hmm...thought i tried that!

    Either way.. Many Thanks!

    Jeff

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •