Testing for Interior.ColorIndex
Hi
this is the default value for 'no color'
--
Regards
Frank Kabel
Frankfurt, Germany
JeffBo wrote:
Hello All,
I have a snippet of code that I've been using to test for the color
format of a cell in a particular range and then change the color
format of cells in a parallel range based upon the outcome of the
test.
Unfortunately, when I used this code snippet in a recent script my
test isn't working.
Here's the snippet and the result I'm getting:
For Each c In Worksheets("Factors").Range("RANK")
If c.Interior.ColorIndex = 37 Then
Worksheets("Factors").Range("FNUM").Cells(counter) .Interior.ColorIndex
= 40 'salmon If c.Interior.ColorIndex = 4 Then
Worksheets("Factors").Range("FNUM").Cells(counter) .Interior.ColorIndex
= 40 'salmon counter = counter + 1
Next c
I have a watch on the c.Interior.ColorIndex and when it hits the
first cell in "RANK" the value becomes -4142 (variant/long).
Typically the cell format should be either 37, 4, or no format.
Any ideas where the -4142 is coming from?
Thanks!
|