View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JulieD JulieD is offline
external usenet poster
 
Posts: 618
Default CF in VB Code - Simple Request

Hi Kevin

this changes the colour of column F, when a value in column F or G changes
to meet the criteria you specified
------
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 6 And Target.Value 1 And Target.Offset(0, 1) < ""
Then '1
Target.Interior.ColorIndex = 36 '2
ElseIf Target.Column = 7 And Target.Value < "" And Target.Offset(0, -1)
1 Then '3

Target.Offset(0, -1).Interior.ColorIndex = 36 '4
ElseIf Target.Column = 6 Then '5
Target.Interior.ColorIndex = xlNone '6
ElseIf Target.Column = 7 Then '7
Target.Offset(0, -1).Interior.ColorIndex = xlNone '8
End If '9
End Sub
-------
to use this code, right mouse click on the sheet tab where you want it to go
and copy & paste it onto the right hand side of the screen - i've put line
numbers at the end of each line so you can fix up any wrapping problems
caused by posting.
--
Cheers
JulieD
check out www.hcts.net.au/tipsandtricks.htm
....well i'm working on it anyway
"Kevin Baker" wrote in message
news:uM1de.726$lt.422@lakeread02...
Hi Everyone,

Simple (I think)... Would like VB Code to do the following:

If cell F2 is greater than 1 AND cell G2 is blank then change the cell
color to Light Yellow.

Of course I need to work for the entire F column and G column

Thanks,
Kevin