Conditional Formatting in a macro


Posted by Rob on July 26, 2001 4:49 PM

OK, I trying to find a way (or another way if possible) to format a row(color and font) based on a cell in the row. For example, if A5 = 2, i want the C row to be red, and white font color. Also, I'd like this to happen for every row in the sheet. I tried using conditional formatting, but this only formats based on the selected cell, not based on another cell. I know this is probably simple, but I dont know any VB :( I'd appreciate any help. Thanks.

Posted by Jack on July 27, 2001 2:15 AM

You do it like this: Choose the cell you want the color chages to happen in. Go to conditional formating then choose formula is in the drop down box and write the formula like this.
=Cell with the reference = condition then choose the color you want it to be below is an example of one i did were i used letters but this could be replaced with numbers or > < =L5="MC"
the only problem is you are limited to 3 conditional formats to a cell im yet to work out how to add more.



Posted by Ian on July 27, 2001 4:57 AM

Try!!


The formula above will not format the row.
try Formula is_

=$a1="apple"

$a1 being the start cell that you want

so! if you selected a1:m100
and you needed the whole row changing based on the value in column A then that is how you do it.

if you need it based on column G then
=$G1="apple"

the $ part makes all cells on that row look at the absolute COLUMN but moves with the relative ROW.

TIP: make sure you select the area from Top Left to Bottom Right, then you can check in the name box as to which ROW/COLUMN to write into the formula.

Hope this makes sense, it's vague to me

Any probs let me know