View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Excelenator[_39_] Excelenator[_39_] is offline
external usenet poster
 
Posts: 1
Default Change cell color based on another cell value


Ok since you are determined to do this through code here you go. Plac
this in the Sheet section of the VBE where your data resides.


Code
-------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'If you already have data in Column H and then enter
'data in column B this will conditionally make the
'data in column B bold/italic if H = Y or y
If Target.Column = 2 Then
If UCase(Range("H" & Target.Row).Value) = "Y" Then
With Target.Font
.Bold = True
.Italic = True
End With
End If
End If
'If you already have data in Column B and then enter
'data in column H this will conditionally make the
'data in column B bold/italic if H = Y or y and will
'remove the bold/italic if column H's value is NOT
'Y or y
If Target.Column = 8 Then
Dim tf As Boolean
tf = True

If UCase(Target.Value) < "Y" Then
tf = False

End If
With Target.Offset(0, -6).Font
.Bold = tf
.Italic = tf
End With
End If
End Su
-------------------


chris46521 Wrote:
I would like to have the fill color of a cell column B change if th
value in another cell in the same row is "Y" or "y." I don't want t
use conditional formatting because there are already a large number o
Ys in column H and the info in column B needs to remain the same fo
those cells. I want the cells to change color just for new entries.
tried copying code from another worksheet but I could not get it t
work. What would be a simple code for doing this? Thanks


--
Excelenato

-----------------------------------------------------------------------
Excelenator's Profile: http://www.excelforum.com/member.php...fo&userid=3676
View this thread: http://www.excelforum.com/showthread.php?threadid=56808