Page 1 of 1

IDENTIFY if Color EXists in Range

Posted: Wed Jun 09, 2010 7:40 am
by bunchukokoy
Hi! Guys,

I'm not sure if this is the right page where I can ask this. But I'm just wondering how can will know if a color, perhaps 'blue' is filled on a cell in MS Excel. I'm using 2003.

Here's the thing, I put a conditional formatting on a range, it's intention is to fill color 'blue' on two or more same-value (duplicate values) cells. But, when I retrieve the color of a cell on that range, it always returns blue even though there are no duplicate values at all on that raNge. Is it because of the conditional formatting that I put? If that so, how will I know if there is indeed a cell colored by blue?
Thanks in Advance!

:D :D :D

bunchukokoy

MOD EDIT: moved to the general forum as its not Cognos related.

Re: IDENTIFY if Color EXists in Range

Posted: Thu Jun 10, 2010 2:31 am
by bunchukokoy
I'm Sorry guys. :)

Re: IDENTIFY if Color EXists in Range

Posted: Fri Jun 11, 2010 8:03 am
by Alan Kirk
bunchukokoy wrote: I'm not sure if this is the right page where I can ask this. But I'm just wondering how can will know if a color, perhaps 'blue' is filled on a cell in MS Excel. I'm using 2003.

Here's the thing, I put a conditional formatting on a range, it's intention is to fill color 'blue' on two or more same-value (duplicate values) cells. But, when I retrieve the color of a cell on that range, it always returns blue even though there are no duplicate values at all on that raNge. Is it because of the conditional formatting that I put? If that so, how will I know if there is indeed a cell colored by blue?
You look at the cell. If it's emitting light with a wavelength of around 475 nanometres, it's blue.

Seriously, you need to be a bit more specific about what you're doing here. Presumably you're doing this in VBA? What properties are you using to do this, Interior.ColorIndex? Interior.Color? If so, conditional formatting will change neither of these; it's separate to the standard format of a cell.

in my opinion rather than testing whether the cell is showing as a particular colour (since the properties can be misleading on that point if conditional formatting is involved) you'd be far better off replicating the conditional formatting test in the VBA code to determine whether the contents of the cell represents a duplication.