Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checking Cell Background Color
I am trying to write a nested If statement based on the background
color in a cell... Some cells (not all) have either a Light Yellow or Red background on the worksheet that I will begin to maintain. If the background color is x, I want this option button set, if the background color is y, this option button gets set. Set PNList = .Cells.Find(what:=FindPN, LookIn:=xlValues, lookat:=xlWhole, searchorder:=xlByRows) This is after it searches from a set pnlist = .cells.find instruction (where PNList is a range). If .Cells(PNList.Row, 1).Font.ColorIndex = 3 Then ckbRedText.Value = True ElseIf .Cells(PNList.Row, 1).Interior.ColorIndex = 19 Then optCURR.Value = True ElseIf .Cells(PNList.Row, 1).Interior.ColorIndex = 3 Then optOLD.Value = True End If The .Cells(PNList.Row, 1).Font.ColorIndex = 3 command works just fine; just cant figure it out when its the cell background color I am looking at... |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Checking Cell Background Color
That looks correct:
Range("A1").Interior.ColorIndex = 19 is the correct test. -- Regards, Tom Ogilvy "Doug Snow" wrote in message om... I am trying to write a nested If statement based on the background color in a cell... Some cells (not all) have either a Light Yellow or Red background on the worksheet that I will begin to maintain. If the background color is x, I want this option button set, if the background color is y, this option button gets set. Set PNList = .Cells.Find(what:=FindPN, LookIn:=xlValues, lookat:=xlWhole, searchorder:=xlByRows) This is after it searches from a set pnlist = .cells.find instruction (where PNList is a range). If .Cells(PNList.Row, 1).Font.ColorIndex = 3 Then ckbRedText.Value = True ElseIf .Cells(PNList.Row, 1).Interior.ColorIndex = 19 Then optCURR.Value = True ElseIf .Cells(PNList.Row, 1).Interior.ColorIndex = 3 Then optOLD.Value = True End If The .Cells(PNList.Row, 1).Font.ColorIndex = 3 command works just fine; just cant figure it out when its the cell background color I am looking at... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cell Background Color | Excel Worksheet Functions | |||
cell background color and cell text color | Excel Worksheet Functions | |||
How do I- IF the cell background is RED in color then contain 1 | Excel Worksheet Functions | |||
Default Border, Font Color, and Cell Background Color | Excel Discussion (Misc queries) | |||
Checking a cell for a specific color in Excel VBA | Excel Programming |