ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Font.ColorIndex (https://www.excelbanter.com/excel-programming/423530-font-colorindex.html)

kirkm[_8_]

Font.ColorIndex
 
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

Mike H

Font.ColorIndex
 
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

"kirkm" wrote:

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


kirkm[_8_]

Font.ColorIndex
 
On Fri, 6 Feb 2009 00:39:02 -0800, Mike H
wrote:

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


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

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