Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Coloring cells
This is the code I use to color a cell based on text in the cell:
If Not Intersect(Target, Range("A5:G56")) Is Nothing Then Select Case Left(Target.Text, 4) Case Is = "Sick" icolor = 38 End Select How can I also get it to color the 2 cells immediately above it? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Coloring cells
Target.offset(-2,0).Resize(3,1).Interior.ColorIndex = icolor
-- Regards, Tom Ogilvy "Patrick Simonds" wrote in message ... This is the code I use to color a cell based on text in the cell: If Not Intersect(Target, Range("A5:G56")) Is Nothing Then Select Case Left(Target.Text, 4) Case Is = "Sick" icolor = 38 End Select How can I also get it to color the 2 cells immediately above it? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Coloring cells
Your code doesn't color anything...
However, you can try: Dim iColor As Long If Not Intersect(Target, Range("A5:G56")) Is Nothing Then Select Case Left(Target.Text, 4) Case Is = "Sick" iColor = 38 Case Else iColor = xlColorIndexNone End Select Target.Offset(-2, 0).Resize(3, 1).Interior.ColorIndex = iColor End If In article , "Patrick Simonds" wrote: This is the code I use to color a cell based on text in the cell: If Not Intersect(Target, Range("A5:G56")) Is Nothing Then Select Case Left(Target.Text, 4) Case Is = "Sick" icolor = 38 End Select How can I also get it to color the 2 cells immediately above it? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Coloring cells | Excel Discussion (Misc queries) | |||
coloring cells | New Users to Excel | |||
coloring cells | Excel Discussion (Misc queries) | |||
Coloring Cells | Excel Worksheet Functions | |||
coloring cells | Excel Programming |