Can I use a macro for color coding?

P

pdgarza

I need some more help with these macros. Here is what I have done so far:

I have an if/then statement in cells T9:T25 that calculates the numbers I
have in cells Q9-25:S9-25. Then I changed the color of the font to orange.
Then I set up a conditional format for these cells:

less than -2%=red
2% to 10%=green
greater than 10%=blue
(anything between -2% and 2% will remain orange)

This part works great.

Now here is what I am trying:
I want the font in cells Q:S to change to the same color as the font in cell
T. So, if the font in cell T9 is red, I want the font in cell Q9:S9 to
change to red. If the color is green, I want it to change to green, and if
it is blue, I want it to change to blue.

I cannot use the conditional formatting for the values in cells Q:S because
the color is based on the value in cell T, not the value in Q:S.

So I think I need to set up a macro but I have no idea how to start it. I
dont know if I need to use an if/then statement or a select case macro.

Please help! Thanks
 
J

Jim Thomlinson

Conditional formatting will still work. You need to change from cell value is
to formula is and then point Q:S back to the value in T. Note that
conditional formatting is looing for a True or False result in determining
whether or not to apply the format
 
S

Sean Timmons

You can use Conditional formatting... The formatting should use formula
=$T9<.2 format.

The $ will free at that column. Highlight the entire row at one time when
you do it, and all columns will format appropriately.

Make sense?
 
P

pdgarza

The only problem with that is if I change it to "formula is" = to T9, it
won't change the color because it is a false statement. The formulas in
cells Q:S are all different from each other and none of the fomulas are equal
to the one in cell T.

That's why I am having so much trouble with this, but I figured a macro
could perform this color change, I just don't know how to set it up.
 
J

Jim Thomlinson

The formula would be
=T9<.02

Which will return true if T9 is less than 2% and that will invoke the
conditional format.
 
P

pdgarza

Yeah! That worked! One other thing though....how would I enter the formula
for: between .0201 and .10
 
S

Sean Timmons

Keep in mind, Excel's logic starts at 1 and works down. So, if first is <.02,
you can make 2nd criterion <.10. Any cells below .02 will be captured by
criterion 1. All between .02 and .1 will be captured by 2.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top