ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Chaging the color of a cell acording to its value (https://www.excelbanter.com/excel-programming/423726-chaging-color-cell-acording-its-value.html)

Dani Lima[_2_]

Chaging the color of a cell acording to its value
 
I want a macro to change the color of a cel acording to its value. It cant be
done with conditional formating cause I have 4 ranges of values.

from 0% to 80% = black and white font
from 81% to 84% = red with white font
from 89% to 92% = yellow with black font
from 93% to 100% = green with white font

Someone can helpme??

Patrick Molloy[_2_]

Chaging the color of a cell acording to its value
 
something like ....

SELECT CASE value
CASE <80
clr = 1
bck=2
CASE <84
clr = 1
bck = 3
etc
END SELECT

with target
..forecolor = clr
..interior.coplor = bck
end with






"Dani Lima" wrote:

I want a macro to change the color of a cel acording to its value. It cant be
done with conditional formating cause I have 4 ranges of values.

from 0% to 80% = black and white font
from 81% to 84% = red with white font
from 89% to 92% = yellow with black font
from 93% to 100% = green with white font

Someone can helpme??


Pecoflyer[_390_]

Chaging the color of a cell acording to its value
 

Dani Lima;221278 Wrote:
I want a macro to change the color of a cel acording to its value. It
cant be
done with conditional formating cause I have 4 ranges of values.

from 0% to 80% = black and white font
from 81% to 84% = red with white font
from 89% to 92% = yellow with black font
from 93% to 100% = green with white font

Someone can helpme??


Why not use CF?

Just make your default format one of the four ( say the first from 0%
to 80% = black and white font) and then apply the three other CF's
you will then only have conditions for

from 81% to 84% = red with white font
from 89% to 92% = yellow with black font
from 93% to 100% = green with white font

HTH


--
Pecoflyer

Cheers -
*'Membership is free' (http://www.thecodecage.com)* & allows file
upload -faster and better answers

*Adding your XL version* to your post helps finding solution faster
------------------------------------------------------------------------
Pecoflyer's Profile: http://www.thecodecage.com/forumz/member.php?userid=14
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=60981


Patrick Molloy[_2_]

Chaging the color of a cell acording to its value
 
i suspect that he has sic CFs --- there are gaps in his numerical ranges

"Pecoflyer" wrote:


Dani Lima;221278 Wrote:
I want a macro to change the color of a cel acording to its value. It
cant be
done with conditional formating cause I have 4 ranges of values.

from 0% to 80% = black and white font
from 81% to 84% = red with white font
from 89% to 92% = yellow with black font
from 93% to 100% = green with white font

Someone can helpme??


Why not use CF?

Just make your default format one of the four ( say the first from 0%
to 80% = black and white font) and then apply the three other CF's
you will then only have conditions for

from 81% to 84% = red with white font
from 89% to 92% = yellow with black font
from 93% to 100% = green with white font

HTH


--
Pecoflyer

Cheers -
*'Membership is free' (http://www.thecodecage.com)* & allows file
upload -faster and better answers

*Adding your XL version* to your post helps finding solution faster
------------------------------------------------------------------------
Pecoflyer's Profile: http://www.thecodecage.com/forumz/member.php?userid=14
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=60981




All times are GMT +1. The time now is 09:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com