Results 1 to 4 of 4

Thread: How do i change font color in a range on Excel 2007

  1. #1
    Join Date
    Apr 2009
    Posts
    91

    How do i change font color in a range on Excel 2007

    I would like to know that how do i change font color in a range on Excel 2007. Let say for example if i would like to create a worksheet in order to calculate money. If i get any negative amount then Excel should display the number in 'Red', while if it gives out positive number then it should display the number in 'Green'. Can any body tell me that how can i do it? Does any body knows about it? Kindly provide me the correct solution for the above issue.

  2. #2
    Join Date
    Jan 2008
    Posts
    3,758

    Re: How do i change font color in a range on Excel 2007

    You can try out the following code:-

    Private Sub Worksheet_Change(ByVal Target As Range)
    Static KeyCel As String
    If StrComp(KeyCel, LCase$(CStr([x10].Value))) = 0 Then Exit Sub
    Application.EnableEvents = False
    With Range("L23")
    .Value = "Of the $" & [x10].Value & " affiliate fee:"
    .Font.Color = vbBlack
    .Characters(Start:=8, Length:=Len([x10].Value) + 1).Font.Color = [x10].Font.Color
    End With
    KeyCel = LCase$([x10].Value)
    Application.EnableEvents = True
    End Sub

  3. #3
    Join Date
    Apr 2008
    Posts
    4,089

    Re: How do i change font color in a range on Excel 2007

    If you want to put a color in a particular cell, then you can try out the following code:-

    =COUNTIF(AE10,"HD") + COUNTIF(AE10,"H") + COUNTIF(AE10,"T1")+ COUNTIF(AE10,"T2") + COUNTIF(AE10,"T3") + COUNTIF(AE10,"T4")+ COUNTIF(AE10,"T5")+ COUNTIF(AE10,"T6")+ COUNTIF(AE10,"T7")+ COUNTIF(AE10,"T7.5")

  4. #4
    Join Date
    May 2008
    Posts
    3,319

    Re: How do i change font color in a range on Excel 2007

    If you want, you can even check out the following code:-

    Sub Color_Part_of_Cell()
    'Print ActiveCell.Characters.Count
    With ActiveCell.Characters(2).Font
    .Color = RGB(36, 182, 36)
    End With

    With ActiveCell.Characters(2, 2).Font
    .Color = RGB(36, 182, 36)
    End With

    With ActiveCell.Characters(, 2).Font
    .Color = RGB(36, 182, 36)
    End With

    End Sub

Similar Threads

  1. How to change font color in taskbar of Windows 8
    By Anikait in forum Customize Desktop
    Replies: 3
    Last Post: 25-05-2013, 10:55 AM
  2. Replies: 2
    Last Post: 01-02-2012, 01:08 PM
  3. How To Change Font Color with CSS
    By Vineeta in forum Software Development
    Replies: 4
    Last Post: 11-01-2010, 02:55 AM
  4. Change font color within Gantt bars
    By Manik in forum Microsoft Project
    Replies: 3
    Last Post: 07-02-2009, 01:12 AM
  5. How to add color and change font size in signature
    By rasena in forum Windows Vista Mail
    Replies: 2
    Last Post: 14-03-2008, 08:30 PM

Posting Permissions

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