Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Change Cell Colour

I want to be able to change the background colour of a
cell if it has specific text in it e.g. if it
has 'Closed' in it i want to become Green. Conditional
formatting does not have enough options.

Cheers

Nick
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change Cell Colour


Conditional formatting is the correct way.

Should read Cell Value equal to Closed,
then under formatting, go to the patterns tab and select
green.


-----Original Message-----
I want to be able to change the background colour of a
cell if it has specific text in it e.g. if it
has 'Closed' in it i want to become Green. Conditional
formatting does not have enough options.

Cheers

Nick
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Change Cell Colour

Hi Nick,

Try pasting the following into the relevant worksheet module (Right-click
the sheet tab | View Code):

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rCell As Range
On Error GoTo CleanUp:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:B10")) Is Nothing Then
For Each rCell In Target
With rCell
Select Case LCase(.Value)
Case "closed": .Interior.ColorIndex = 4
Case "open": .Interior.ColorIndex = 3
Case "ajar": .Interior.ColorIndex = 5
Case "obstructed": .Interior.ColorIndex = 7
Case "hidden": .Interior.ColorIndex = 8
Case Else: .Interior.ColorIndex = xlNone
End Select
End With
Next
End If

CleanUp:
Application.EnableEvents = True
End Sub

Change Range("A1:B10") to to reflect the cells you need to format.
Similarly, amend/add Case values and ColorIndex values to suit.


---
Regards,
Norman



"Nick" wrote in message
...
I want to be able to change the background colour of a
cell if it has specific text in it e.g. if it
has 'Closed' in it i want to become Green. Conditional
formatting does not have enough options.

Cheers

Nick



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
Change cell colour Min Excel Worksheet Functions 1 March 28th 07 02:56 AM
Change colour of cell if there is no value Jennifer1960 Excel Worksheet Functions 2 August 20th 06 01:05 AM
change row colour when a value is given in a cell Alex Simpson Excel Worksheet Functions 8 August 8th 06 01:46 PM
change a cell background colour to my own RGB colour requirements Stephen Doughty Excel Discussion (Misc queries) 4 June 16th 06 01:08 PM
COLOUR CHANGE IS A CELL Mav Excel Discussion (Misc queries) 1 April 23rd 05 11:22 AM


All times are GMT +1. The time now is 10:20 PM.

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

About Us

"It's about Microsoft Excel"