ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   cells automatically colour differently with 'what if' scenarios (https://www.excelbanter.com/excel-programming/322737-cells-automatically-colour-differently-what-if-scenarios.html)

Kenny @ TLGC

cells automatically colour differently with 'what if' scenarios
 
I want to add YES or NO to a cell in EXCEL. If I type YES I want cell to
automatically colour GREEN. If I type NO I want cell to automatically colour
RED with the adjacent cell also to colour RED.
Any help apprecaited.

JE McGimpsey

cells automatically colour differently with 'what if' scenarios
 
Take a look at Conditional Formatting in XL Help.

In article ,
Kenny @ TLGC <Kenny @ wrote:

I want to add YES or NO to a cell in EXCEL. If I type YES I want cell to
automatically colour GREEN. If I type NO I want cell to automatically colour
RED with the adjacent cell also to colour RED.
Any help apprecaited.


JulieD

cells automatically colour differently with 'what if' scenarios
 
Hi

this can be achieved via conditional formatting
select the cell that you want to go green or red
choose format / conditional formatting
choose
value is
equal to
type
yes
click format - choose green - ok
choose ADD
choose
value is
type
no
click format - choose red - ok twice

now choose the cell that you want to go red if the previous cell goes red
choose format / conditional formatting
choose
formula is
type
=$A1="NO"
(where A1 is the cell reference of the previous cell)
click format ...etc

Cheers
JulieD



"Kenny @ TLGC" <Kenny @ wrote in message
...
I want to add YES or NO to a cell in EXCEL. If I type YES I want cell to
automatically colour GREEN. If I type NO I want cell to automatically
colour
RED with the adjacent cell also to colour RED.
Any help apprecaited.




Tom Ogilvy

cells automatically colour differently with 'what if' scenarios
 
Look at Format=Conditional Formatting

you don't need code for this.

--
Regards,
Tom Ogilvy

"Kenny @ TLGC" <Kenny @ wrote in message
...
I want to add YES or NO to a cell in EXCEL. If I type YES I want cell to
automatically colour GREEN. If I type NO I want cell to automatically

colour
RED with the adjacent cell also to colour RED.
Any help apprecaited.




Ben

cells automatically colour differently with 'what if' scenario
 
this won't help the cell adjacent to it though

insert this in the worksheet object
but the interior.colorindex will change the background color
the font.colorindex will change the font color, since you did not specify
the one you needed I reccomend you comment out or delete the one you don't
want or else you will not see what you type


Private Sub Worksheet_Change(ByVal Target As Range)
if target.value = "YES" then
target.Font.ColorIndex = 4
target.Interior.ColorIndex = 4
end if
if target.value = "NO" then
range(cells(target.row,target.column),cells(target .row,target.column+1)).select
selection.Interior.ColorIndex = 3
selection.Font.ColorIndex = 3
end if
end sub
"JE McGimpsey" wrote:

Take a look at Conditional Formatting in XL Help.

In article ,
Kenny @ TLGC <Kenny @ wrote:

I want to add YES or NO to a cell in EXCEL. If I type YES I want cell to
automatically colour GREEN. If I type NO I want cell to automatically colour
RED with the adjacent cell also to colour RED.
Any help apprecaited.



Ben

cells automatically colour differently with 'what if' scenario
 
conditional formatting won't help the cell adjacent to it though

insert this in the worksheet object
but the interior.colorindex will change the background color
the font.colorindex will change the font color, since you did not specify
the one you needed I reccomend you comment out or delete the one you don't
want or else you will not see what you type


Private Sub Worksheet_Change(ByVal Target As Range)
if target.value = "YES" then
target.Font.ColorIndex = 4
target.Interior.ColorIndex = 4
end if
if target.value = "NO" then
range(cells(target.row,target.column),cells(target .row,target.column+1)).select
selection.Interior.ColorIndex = 3
selection.Font.ColorIndex = 3
end if
end sub


"JE McGimpsey" wrote:

Take a look at Conditional Formatting in XL Help.

In article ,
Kenny @ TLGC <Kenny @ wrote:

I want to add YES or NO to a cell in EXCEL. If I type YES I want cell to
automatically colour GREEN. If I type NO I want cell to automatically colour
RED with the adjacent cell also to colour RED.
Any help apprecaited.



Ben

cells automatically colour differently with 'what if' scenario
 
good point, never mind my post this is much smarter lol

"JulieD" wrote:

Hi

this can be achieved via conditional formatting
select the cell that you want to go green or red
choose format / conditional formatting
choose
value is
equal to
type
yes
click format - choose green - ok
choose ADD
choose
value is
type
no
click format - choose red - ok twice

now choose the cell that you want to go red if the previous cell goes red
choose format / conditional formatting
choose
formula is
type
=$A1="NO"
(where A1 is the cell reference of the previous cell)
click format ...etc

Cheers
JulieD



"Kenny @ TLGC" <Kenny @ wrote in message
...
I want to add YES or NO to a cell in EXCEL. If I type YES I want cell to
automatically colour GREEN. If I type NO I want cell to automatically
colour
RED with the adjacent cell also to colour RED.
Any help apprecaited.





JE McGimpsey

cells automatically colour differently with 'what if' scenario
 
Of course it will...

Select A1 & B1

CF1: Formula is =($A1="YES")
Format1: Green

CF2: Formula is =($A1="NO")
Format2: Red

In article ,
ben wrote:

conditional formatting won't help the cell adjacent to it though



All times are GMT +1. The time now is 05:30 PM.

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