Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
CF in VB Code - Simple Request
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
CF in VB Code - Simple Request
Turn on the macro recorder (Tools | Macro Record new macro...), set
the conditional format through the UI, and turn off the recorder. XL should give you the necessary code. -- Regards, Tushar Mehta www.tushar-mehta.com Excel, PowerPoint, and VBA add-ins, tutorials Custom MS Office productivity solutions In article <uM1de.726$lt.422@lakeread02, says... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Request for a code | Excel Discussion (Misc queries) | |||
Request for VB to do something simple (insert text in a column ofcells) | Excel Discussion (Misc queries) | |||
Here is a simple formula request from a newb | Excel Worksheet Functions | |||
DATEDIF Simple request | Excel Worksheet Functions | |||
quick code request | Excel Programming |