Font.ColorIndex

  • Thread starter Thread starter kirkm
  • Start date Start date
K

kirkm

Does anyone know why

debug.print Worksheets("Sheet").Range("C955").Font.ColorIndex

sometimes returns a negative 4 digit number (e.g. -4105)
when it should return something else entirely, like a 7?

Thanks - Kirk
 
Hi,

It will return that if the colorindex is xlautomatic

Try this

Range("a1").Font.ColorIndex = xlAutomatic
Debug.Print Worksheets("Sheet").Range("a1").Font.ColorIndex


Mike
 
Hi,

It will return that if the colorindex is xlautomatic

Try this

Range("a1").Font.ColorIndex = xlAutomatic
Debug.Print Worksheets("Sheet").Range("a1").Font.ColorIndex

Thanks Mike. I found that first line turns the text to black and
-4105 is the result.

Does this mean if you set it to NOT xlAutomtatic it will return
(what seems) the right number ?

How would you make it so, and does this also change the text colour?
I'd rather just detect the colour, not alter it.
Cheers - Kirk
 
Back
Top