I have a row with a bunch of numbers from 1 to 10.
I need a macro (or something) that colours the cell
green for numbers less than or equal to 5, yellow for
6-8 and red for 9-10.
How can I do this?
Select all of the cells in the row that will need to have this functionality
(if you are not sure, and these numbers are the only ones that will be in
the row, then select the entire row). Note which cell is the highlighted one
(it will be the non-shaded one)... for my example, I am assume we are
talking about Row A and that A1 is the highlighted cell (you will use the
address for the highlighted cell in your own selection in place of the A1
that I use). With the range selected, click on Format/ConditionalFormatting
in Excel's menu bar. Click the Add button twice on the dialog box that
appears (so that you will see three "Conditions" listed. In the first combo
box in each condition, select "Formula Is". Put these formulas into the
indicated "Conditions"...
Condition 1: =AND(A1<>"",A1<=5)
Condition 2: =AND(A1<>"",A1<=8)
Condition 3: =AND(A1<>"",A1<=10)
Next, click the format button for Condition 1, click the Patterns tab on the
dialog box that appears and select the shade of green that you want the cell
to be colored in if the value is less than or equal to 5. Hit OK. Do the
same thing for Condition 2 (selecting a shade of yellow) and Condition 3
(selecting a shade of red). Once you have finished that, click OK on the
Conditional Formatting screen and the cells you highlighted will color in
correctly when the numbers you indicated are entered into them.
Rick