View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Ben Ben is offline
external usenet poster
 
Posts: 509
Default 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.