Consulting

Results 1 to 6 of 6

Thread: Alter colour of cell text based on value of cell next to it?

  1. #1
    VBAX Regular
    Joined
    Oct 2007
    Posts
    11
    Location

    Alter colour of cell text based on value of cell next to it?

    Hi,

    I have a number of values running down column C. Rather than applying conditional formatting to the column to change the text colour of these values what I would like to do is change the colour of text in the cell next to each value (ie. Column D).

    I can do this for an individual cell using a formula in conditional formatting which appears something like =$C$4<5 and would apply to $D$4 but because these aren't relative I can't copy this formula down for each cell in Column D. Make sense?

    Is there a way I can do this using some other method?

    Cheers.

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    change the formula to
    =$C4<5
    then use the format painter to paint the conditional format to the rest of column D. The reference to column C is absolute, but the relative reference of the row number allows the conditional formatting to be painted down successfully.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Regular
    Joined
    Oct 2007
    Posts
    11
    Location
    Hi, I've tried that but I can only 'format paint' one cell at a time. If I select more than one cell say D4 to D10 the formatting of cells $D$4:$D$10 relate to $C4 and not each cell in series.

    Cheers.

  4. #4
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You can format paint the whole column by applying it to the D heading. You can also select the formatted cell and drag using the fill handle to apply to other cells.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  5. #5
    VBAX Regular
    Joined
    Oct 2007
    Posts
    11
    Location
    Thanks. Sorted. Is there a way to apply a formula based on whether the cell is empty. In other words, if cell Cx is empty apply a particular format to cell Dx ?

  6. #6
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You need two conditions
    =AND($C1<5,$C1<>"")
    =$C1=""
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

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