ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Identify Cell Color Index (https://www.excelbanter.com/excel-programming/304936-identify-cell-color-index.html)

Voskre

Identify Cell Color Index
 
Hi,
I'm using Excell 2000.

In cell B1 I want to insert the color index of cell A1 and I'm using the
following function copied from Internet:

Function showColorIndex(targetcell)
showColorIndex = targetcell.Interior.ColorIndex
End Function

In B1 I get the number -4142 and it can not be.
Even for the next rows (i.e. B2 for A2 color, B3 for A3 color etc., all with
differente colors) I always get -4142.

What's wrong with that function as all AddIns are duly installed?

Thanks for any help.

Dominic.



Gord Dibben

Identify Cell Color Index
 
Voskre

In B1 enter =showColorIndex(A1) and drag/copy down column B.

Works for me if column B is formatted to general and Auto-calcuation is set.

-4142 is the default cell color "no fill"

Gord Dibben Excel MVP

On Sat, 24 Jul 2004 15:19:06 GMT, "Voskre"
wrote:

Hi,
I'm using Excell 2000.

In cell B1 I want to insert the color index of cell A1 and I'm using the
following function copied from Internet:

Function showColorIndex(targetcell)
showColorIndex = targetcell.Interior.ColorIndex
End Function

In B1 I get the number -4142 and it can not be.
Even for the next rows (i.e. B2 for A2 color, B3 for A3 color etc., all with
differente colors) I always get -4142.

What's wrong with that function as all AddIns are duly installed?

Thanks for any help.

Dominic.



JE McGimpsey

Identify Cell Color Index
 
Are your colors set by Conditional Formatting? showColorIndex won't pick
that up - you'll need a function that checked the same conditions as
your CF.

-4142 is the colorindex of a cell with no color applied.

In article ,
"Voskre" wrote:

I'm using Excell 2000.

In cell B1 I want to insert the color index of cell A1 and I'm using the
following function copied from Internet:

Function showColorIndex(targetcell)
showColorIndex = targetcell.Interior.ColorIndex
End Function

In B1 I get the number -4142 and it can not be.
Even for the next rows (i.e. B2 for A2 color, B3 for A3 color etc., all with
differente colors) I always get -4142.

What's wrong with that function as all AddIns are duly installed?


Voskre

Identify Cell Color Index
 
Hi Gord,

before writing to the NG, I did as you suggested: now I did it once again
but it does not work.
sorry....
I can send my file if you like.

Thanks in any case.

Dominic



"Gord Dibben" <gorddibbATshawDOTca ha scritto nel messaggio
...
Voskre

In B1 enter =showColorIndex(A1) and drag/copy down column B.

Works for me if column B is formatted to general and Auto-calcuation is

set.

-4142 is the default cell color "no fill"

Gord Dibben Excel MVP

On Sat, 24 Jul 2004 15:19:06 GMT, "Voskre"
wrote:

Hi,
I'm using Excell 2000.

In cell B1 I want to insert the color index of cell A1 and I'm using the
following function copied from Internet:

Function showColorIndex(targetcell)
showColorIndex = targetcell.Interior.ColorIndex
End Function

In B1 I get the number -4142 and it can not be.
Even for the next rows (i.e. B2 for A2 color, B3 for A3 color etc., all

with
differente colors) I always get -4142.

What's wrong with that function as all AddIns are duly installed?

Thanks for any help.

Dominic.





Bob Phillips[_6_]

Identify Cell Color Index
 
Dominic,

assuming that you are not using conditional formatting colouring, take a
look at this page

http://www.xldynamic.com/source/xld.ColourCounter.html
Processing Coloured Cells

It's quite a bit more complicated thatn your simple function, but it caters
foir the defaults.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Voskre" wrote in message
...
Hi,
I'm using Excell 2000.

In cell B1 I want to insert the color index of cell A1 and I'm using the
following function copied from Internet:

Function showColorIndex(targetcell)
showColorIndex = targetcell.Interior.ColorIndex
End Function

In B1 I get the number -4142 and it can not be.
Even for the next rows (i.e. B2 for A2 color, B3 for A3 color etc., all

with
differente colors) I always get -4142.

What's wrong with that function as all AddIns are duly installed?

Thanks for any help.

Dominic.





Voskre

Identify Cell Color Index
 
Thank for any help.
I did not use the conditional formatting.

As per Bob Phillips suggestion I used the:

"
Function ColorIndex(rng As Range, _
Optional text As Boolean = False) As Variant

"
from the page you mentioned but I got for any cell I referred to always the
same number i.e. 2

Thanks again for yr attention.

Dominic


"Bob Phillips" ha scritto nel messaggio
...
Dominic,

assuming that you are not using conditional formatting colouring, take a
look at this page

http://www.xldynamic.com/source/xld.ColourCounter.html
Processing Coloured Cells

It's quite a bit more complicated thatn your simple function, but it

caters
foir the defaults.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Voskre" wrote in message
...
Hi,
I'm using Excell 2000.

In cell B1 I want to insert the color index of cell A1 and I'm using the
following function copied from Internet:

Function showColorIndex(targetcell)
showColorIndex = targetcell.Interior.ColorIndex
End Function

In B1 I get the number -4142 and it can not be.
Even for the next rows (i.e. B2 for A2 color, B3 for A3 color etc., all

with
differente colors) I always get -4142.

What's wrong with that function as all AddIns are duly installed?

Thanks for any help.

Dominic.







Voskre

Identify Cell Color Index
 
I found the solution looking at

http://www.cpearson.com/excel/CFColors.htm

Thanks to everybody for any help I got.

D



"Bob Phillips" ha scritto nel messaggio
...
Dominic,

assuming that you are not using conditional formatting colouring, take a
look at this page

http://www.xldynamic.com/source/xld.ColourCounter.html
Processing Coloured Cells

It's quite a bit more complicated thatn your simple function, but it

caters
foir the defaults.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Voskre" wrote in message
...
Hi,
I'm using Excell 2000.

In cell B1 I want to insert the color index of cell A1 and I'm using the
following function copied from Internet:

Function showColorIndex(targetcell)
showColorIndex = targetcell.Interior.ColorIndex
End Function

In B1 I get the number -4142 and it can not be.
Even for the next rows (i.e. B2 for A2 color, B3 for A3 color etc., all

with
differente colors) I always get -4142.

What's wrong with that function as all AddIns are duly installed?

Thanks for any help.

Dominic.







Bob Phillips[_6_]

Identify Cell Color Index
 
You said you did not use conditional formatting!

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Voskre" wrote in message
...
I found the solution looking at

http://www.cpearson.com/excel/CFColors.htm

Thanks to everybody for any help I got.

D



"Bob Phillips" ha scritto nel

messaggio
...
Dominic,

assuming that you are not using conditional formatting colouring, take a
look at this page

http://www.xldynamic.com/source/xld.ColourCounter.html
Processing Coloured Cells

It's quite a bit more complicated thatn your simple function, but it

caters
foir the defaults.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Voskre" wrote in message
...
Hi,
I'm using Excell 2000.

In cell B1 I want to insert the color index of cell A1 and I'm using

the
following function copied from Internet:

Function showColorIndex(targetcell)
showColorIndex = targetcell.Interior.ColorIndex
End Function

In B1 I get the number -4142 and it can not be.
Even for the next rows (i.e. B2 for A2 color, B3 for A3 color etc.,

all
with
differente colors) I always get -4142.

What's wrong with that function as all AddIns are duly installed?

Thanks for any help.

Dominic.










All times are GMT +1. The time now is 06:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com