Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DD DD is offline
external usenet poster
 
Posts: 68
Default Conditional formatting

I want to use more than 3 conditions, I know that there is a way to use VBA
to do this but I have no idea of how to use vba. What I have is a list
contained in a cell from which the user picks a word and I want each word to
have an associated colour appear in another cell. I cant seem to understand
how the VB codes are supposed to work so i have not been able to adapt them
from other users suggestions

I cannot use the tool in www.xldynamic.com/source/xld.CFPlus as Im not
allowed to download it, also multiple users will need to use the s/sheet


What I need to do is when a user selects
"On track" in the list the corresponding cell in the work sheet needs to
turn green
"completed" needs to be blue
"overdue" needs to be red
"late" needs to be red
"problem" needs to be red
"Agreed" needs to be purple
"confirmed" needs to be purple

would greatly appreciate any help

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Conditional formatting

Option Explicit

Public Enum xlColorIndex
xlCIBlack = 1
xlCIWhite = 2
xlCIRed = 3
xlCIBrightGreen = 4
xlCIBlue = 5
xlCIYellow = 6
xlCIPink = 7
xlCITurquoise = 8
xlCIDarkRed = 9
xlCIGreen = 10
xlCIDarkBlue = 11
xlCIDarkYellow = 12
xlCIViolet = 13
xlCITeal = 14
xlCIGray25 = 15
xlCIGray50 = 16
xlCIPeriwinkle = 17
xlCIPlum = 18
xlCIIvory = 19
xlCILightTurquoise = 20
xlCIDarkPurple = 21
xlCICoral = 22
xlCIOceanBlue = 23
xlCIIceBlue = 24
'xlCIDarkBlue = 25
'xlCIPink = 26
'xlCIYellow = 27
'xlCITurquoise = 28
'xlCIViolet = 29
'xlCIDarkRed = 30
'xlCITeal = 31
'xlCIBlue = 32
xlCISkyBlue = 33
xlCILightGreen = 35
xlCILightYellow = 36
xlCIPaleBlue = 37
xlCIRose = 38
xlCILavender = 39
xlCITan = 40
xlCILightBlue = 41
xlCIAqua = 42
xlCILime = 43
xlCIGold = 44
xlCILightOrange = 45
xlCIOrange = 46
xlCIBlueGray = 47
xlCIGray40 = 48
xlCIDarkTeal = 49
xlCISeaGreen = 50
xlCIDarkGreen = 51
xlCIBrown = 53
xlCIIndigo = 55
xlCIGray80 = 56
End Enum


'-----------------------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)
'-----------------------------------------------------------------
Const WS_RANGE As String = "H1:H10" '<=== Change to suit

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Select Case LCase(.Value)
Case "overdue", "late", "problem":
.Interior.ColorIndex = xlCIRed
Case "agreed", "confirmed: "
.Interior.ColorIndex = xlCILavender
Case "completed": .Interior.ColorIndex = xlCIBlue
Case "On track": .Interior.ColorIndex = xlCIGreen
End Select
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"DD" wrote in message
...
I want to use more than 3 conditions, I know that there is a way to use

VBA
to do this but I have no idea of how to use vba. What I have is a list
contained in a cell from which the user picks a word and I want each word

to
have an associated colour appear in another cell. I cant seem to

understand
how the VB codes are supposed to work so i have not been able to adapt

them
from other users suggestions

I cannot use the tool in www.xldynamic.com/source/xld.CFPlus as Im not
allowed to download it, also multiple users will need to use the s/sheet


What I need to do is when a user selects
"On track" in the list the corresponding cell in the work sheet needs to
turn green
"completed" needs to be blue
"overdue" needs to be red
"late" needs to be red
"problem" needs to be red
"Agreed" needs to be purple
"confirmed" needs to be purple

would greatly appreciate any help



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
How can I convert conditional formatting into explicit formatting? Patrick Harris Excel Discussion (Misc queries) 0 April 9th 09 12:00 AM
Conditional formatting--different formatting depending on cell con Tammy S. Excel Discussion (Misc queries) 3 March 30th 09 08:11 PM
Protect Cell Formatting including Conditional Formatting Mick Jennings Excel Discussion (Misc queries) 5 November 13th 07 05:32 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 3 January 20th 07 02:02 PM
Conditional Formatting that will display conditional data BrainFart Excel Worksheet Functions 1 September 13th 05 05:45 PM


All times are GMT +1. The time now is 03:03 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"