PC Review


Reply
Thread Tools Rate Thread

colour cell on condition

 
 
pswanie
Guest
Posts: n/a
 
      28th Apr 2008
hey
i need a code wich will change the collour of a cell when the user enter the
word "off".
so when he enter "off" in c5 i need c5 to turn bright yelow..
(will this go in the worksheet change?)
 
Reply With Quote
 
 
 
 
Fayyaadh Ebrahim
Guest
Posts: n/a
 
      28th Apr 2008
On Apr 28, 5:24 pm, pswanie <pswa...@discussions.microsoft.com> wrote:
> hey
> i need a code wich will change the collour of a cell when the user enter the
> word "off".
> so when he enter "off" in c5 i need c5 to turn bright yelow..
> (will this go in the worksheet change?)


Try Conditional Formatting.

Go to Format -> Conditional Formatting

If cell value is equal to off, then click "Format...", go to the
Patterns tab and change the color to a bright yellow.
 
Reply With Quote
 
pswanie
Guest
Posts: n/a
 
      28th Apr 2008
thats how and what they do now. but i want to automate the colour change...

and i forgot. any word (open, close, off) must if possible be in caps. if
caps aint on it must change the word to caps
 
Reply With Quote
 
Fayyaadh Ebrahim
Guest
Posts: n/a
 
      28th Apr 2008
On Apr 28, 6:07 pm, pswanie <pswa...@discussions.microsoft.com> wrote:
> thats how and what they do now. but i want to automate the colour change...
>
> and i forgot. any word (open, close, off) must if possible be in caps. if
> caps aint on it must change the word to caps


I obtained the code in the body by simply recording a macro and doing
the conditional formatting. The code will change the color of a cell
to yellow if the user inputs the word "off". The code will sit in a
Worksheet_Change event sub:

Private Sub Worksheet_Change(ByVal Target As Range)

Target.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=""off"""
Target.FormatConditions(1).Interior.ColorIndex = 6

End Sub

I'm not sure how to do the caps part, best wait for a reply from the
more experienced users on that one.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Condition based on cell colour Richhall Microsoft Excel Worksheet Functions 2 25th Mar 2007 04:23 PM
auto change cell text colour resulting from a condition =?Utf-8?B?Q2hpbmFtYW4=?= Microsoft Excel Worksheet Functions 2 14th Dec 2006 01:19 AM
Choosing offset on condition found in combobox change colour of cell?? Simon Lloyd Microsoft Excel Programming 2 4th Jul 2006 12:53 AM
Change the Row Colour, using a cell condition belgarth58 Microsoft Excel Misc 1 7th Feb 2006 07:42 PM
Re: How do I change the colour of a cell dependent on a condition? JulieD Microsoft Excel Misc 1 15th Sep 2004 04:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:26 PM.