Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Change cell color for more than 3 conditional statements
I need to change the cell color for more than 3 conditional statements. How
do I do this? |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Change cell color for more than 3 conditional statements
VBA.
'----------------------------------------------------------------- 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 .Value Case 1: .Interior.ColorIndex = 3 'red Case 2: .Interior.ColorIndex = 6 'yellow Case 3: .Interior.ColorIndex = 5 'blue Case 4: .Interior.ColorIndex = 10 'green 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 (there's no email, no snail mail, but somewhere should be gmail in my addy) "Katie" wrote in message ... I need to change the cell color for more than 3 conditional statements. How do I do this? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I change cell color using conditional formatting | Excel Discussion (Misc queries) | |||
change color of text in cell without conditional formatting | Excel Discussion (Misc queries) | |||
Result of IF conditional change cell color | Excel Discussion (Misc queries) | |||
Cell color change without using conditional formatting | Excel Discussion (Misc queries) | |||
Conditional change to cell color | Excel Discussion (Misc queries) |