Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Request for a code FARAZ QURESHI Excel Discussion (Misc queries) 0 January 27th 08 02:59 PM
Request for VB to do something simple (insert text in a column ofcells) David Nebenzahl Excel Discussion (Misc queries) 5 November 21st 07 04:24 AM
Here is a simple formula request from a newb Darryl Excel Worksheet Functions 5 July 27th 06 08:51 PM
DATEDIF Simple request TAS-LGS Excel Worksheet Functions 1 October 26th 05 01:30 PM
quick code request michelle Excel Programming 1 June 23rd 04 09:59 AM


All times are GMT +1. The time now is 02:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"