Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks Shane and Bob, the code works fine except it does not follow what the
range is saying, the only cell that changes color is O5 and none of the others react. Below is the final code. Any corrections would be appreciated. NOTE: I entered additional code to change the font colors as well. Private Sub Worksheet_Change(ByVal Target As Range) '----------------------------------------------------------------- Const WS_RANGE As String = "O5:O43" On Error Resume Next If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then With Target.Interior Select Case Target Case "": .ColorIndex = xlNone Case 1: .ColorIndex = 3 Case 2: .ColorIndex = 2 Case 3: .ColorIndex = 41 Case 4: .ColorIndex = 6 Case 5: .ColorIndex = 50 Case 6: .ColorIndex = 1 Case 7: .ColorIndex = 46 Case 8: .ColorIndex = 7 Case 9: .ColorIndex = 42 Case 10: .ColorIndex = 13 Case 11: .ColorIndex = 48 Case 12: .ColorIndex = 4 End Select End With End If On Error Resume Next If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then With Target.Font Select Case Target Case "": .ColorIndex = xlNone Case 1: .ColorIndex = 2 Case 2: .ColorIndex = 1 Case 3: .ColorIndex = 2 Case 4: .ColorIndex = 1 Case 5: .ColorIndex = 6 Case 6: .ColorIndex = 6 Case 7: .ColorIndex = 1 Case 8: .ColorIndex = 1 Case 9: .ColorIndex = 1 Case 10: .ColorIndex = 2 Case 11: .ColorIndex = 3 Case 12: .ColorIndex = 1 End Select End With End If ws_exit: Application.EnableEvents = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If statement and colors | Excel Discussion (Misc queries) | |||
If then statement continued! | Excel Discussion (Misc queries) | |||
Should I generally request "post a poll" when I post a new thread? | Excel Discussion (Misc queries) | |||
Continued Column titles | Excel Discussion (Misc queries) | |||
unhide personal.xls ..... continued | Excel Discussion (Misc queries) |