Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cell Background Color Joe Gieder Excel Worksheet Functions 4 July 15th 08 09:24 PM
cell background color and cell text color Jeff Klein Excel Worksheet Functions 1 November 1st 07 08:59 PM
How do I- IF the cell background is RED in color then contain 1 sunshine19992 Excel Worksheet Functions 3 May 23rd 07 09:26 PM
Default Border, Font Color, and Cell Background Color Elijah Excel Discussion (Misc queries) 1 October 28th 05 04:10 PM
Checking a cell for a specific color in Excel VBA ColdCore Excel Programming 1 January 20th 04 09:31 PM


All times are GMT +1. The time now is 07:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"