Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How does one achieve the following:

If (the value of cell A1) < (than the value 0) then (all the text representing the number in cell A1) should be the color (RED)?

share|improve this question

migrated from stackoverflow.com Sep 14 '12 at 23:12

This question came from our site for professional and enthusiast programmers.

1  
You don't need comditional formatting to do this. Right click on the cell and select formatting. Select "Number" from the listbox and then select one of the two options with red in it. –  wbeard52 Sep 3 at 13:45

2 Answers 2

up vote 2 down vote accepted

Basic conditional formatting will do this (without adding a function directly inside the cell)

  1. Select your cell/ cell range from top left down (I used A1:A3 below)
  2. From the Home tab on the ribbon , pick Conditional Formatting
  3. Pick "Format only cells that contain"
  4. Cell Value .... less than ..... =0
  5. click Format and pick a Red font

Debra Dalgleish has an excellent reference on conditional formatting here

enter image description here

share|improve this answer

Your question is not entirely clear, so I'm going to make a few assumptions in trying to understand and answer it. Maybe your instructor had the same problem?

In writing VBA code, you can get/set the text color of a cell by accessing the ColorIndex property. This value represents the index of one of the default color values, between 1 and 56. And in addition to the 56 colors already in the palette, there are two special values: xlColorIndexNone specifies that no color has been assigned, and xlColorIndexAutomatic specifies that the default color is used.

For example, to set the text color of cell (1, 3) to red, you would write:

Cell(1, 3).Font.ColorIndex = 3
share|improve this answer
    
You overthink this.By the way my insturctor under stay the qusetion just fine this is not vba code. What I am talking about is Microsoft excel 2010 nothing more. –  user583713 Feb 10 '12 at 8:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.