Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Changing cell color based on a value in another cell
I need a macro which will look at each row and if the cell in column Z =2
then the cell in column C should be formatted Yellow, if it = 3 the cell will be formatted Red and if it is greater than 3 the cell will be formatted Grey. There are 941 rows startimng at row 7. I know this can be done as a conditional format, but this is for use with Office 2003 and because of other conditional formats I am using I have exceeded the three allowed conditional formats |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Changing cell color based on a value in another cell
This should do what you want:
Sub ColorCells() Dim rCell As Range Dim nCount As Long With Range("Z7:Z100") ..Interior.ColorIndex = xlColorIndexNone For Each rCell In .Cells If rCell = "2" Then rCell.Offset(0, -23).Interior.ColorIndex = 6 End If If rCell = "3" Then rCell.Offset(0, -23).Interior.ColorIndex = 3 End If If rCell "3" Then rCell.Offset(0, -23).Interior.ColorIndex = 15 End If Next rCell End With End Sub Regards, Ryan-- -- RyGuy "ordnance1" wrote: I need a macro which will look at each row and if the cell in column Z =2 then the cell in column C should be formatted Yellow, if it = 3 the cell will be formatted Red and if it is greater than 3 the cell will be formatted Grey. There are 941 rows startimng at row 7. I know this can be done as a conditional format, but this is for use with Office 2003 and because of other conditional formats I am using I have exceeded the three allowed conditional formats |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Changing Cell Background Color based on data from another cell | Excel Discussion (Misc queries) | |||
Changing a color in a cell based on the text in another cell | Excel Discussion (Misc queries) | |||
Changing cell text color based on cell number | Excel Programming | |||
Changing cell text color based on cell number | Excel Programming | |||
Changing cell text color based on cell number | Excel Programming |