Share via

.Color versus .ColorIndex

Anonymous
2010-08-16T19:00:37+00:00

Excel 2007 seems to like .color "better" than .colorindex which I'm used to in xl 2002.

I know that the color #'s in xl 2007 have changed.

My context is .Font.????

MSo help is not helpful on what the differences , pro or con,  are

over using .Color or .ColorIndex,  What are they?

Thanks,

  Neal Z

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

  1. Anonymous
    2010-08-16T21:09:19+00:00

    colorindex uses a color palette with an index number to select the color from the palette

    example, 49 = Blue (or one of the blues):

    font.colorindex = 49  

    color uses the RGB properties and has millions of combinations you can pick

    RGB(256, 0, 0) = Red

    RGB(0, 256, 0) = Green

    RGB(0, 0, 256) = Blue

    Example:

    font.colorindex = RGB(0,0,256)

    Good Luck

    2 people found this answer helpful.
    0 comments No comments

6 additional answers

Sort by: Most helpful
  1. Doug Robbins - MVP - Office Apps and Services 322.9K Reputation points MVP Volunteer Moderator
    2010-08-17T06:28:01+00:00

    There are a couple of issues with the information that you have been given.

    1. The values of the RGB components have a range of 0 - 255.  As using a number greater that that does not produce an error, I assume that any number greater than 255 is taken to be 255.
    2. Using font.colorindex = RGB(0,0,256) will produce an error.  It shoud be font.color = RGB(0,0,256)

    The results of using the RGB values have not changed.  The colorindex was added by Excel 2007

    I would suggest using

    font.color = RGB(#,#,#)

    as that can be used across all Office applications and will return the same color no matter what color palette is selected under the Page Layout>Themes>Colors facility.

    On the other hand, if you want to change a color scheme, I guess if you use ColorIndex values, you can change the colors by changing the color pallette via the facility mentioned above.

    -- Hope this helps.

    Doug Robbins - Word MVP,

    dkr[atsymbol]mvps[dot]org

    Posted via the Community Bridge

    "Neal Zimm" wrote in message news:*** Email address is removed for privacy ***...

    Thanks ND, a big help.  A quick follow up,

    Are the index numbers for the palette the same in xl2007 as earlier for .ColorIndex ?

    Thanks.


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org

    2 people found this answer helpful.
    0 comments No comments
  2. Doug Robbins - MVP - Office Apps and Services 322.9K Reputation points MVP Volunteer Moderator
    2010-08-17T10:22:56+00:00

    Maybe it was just the FormatColor.ColorIndex that was added in 2007.

    From the VBE Help File

    Quote

    FormatColor.ColorIndex Property

    Returns or sets one of the constants of the XlColorIndex enumeration, specifying if the fill color is expressed as an index value into the current color palette.

    Version Information

    Version Added:  Excel 2007

    Syntax

    expression.ColorIndex

    expression   A variable that represents a FormatColor object.

    Remarks

    This property is used for each threshold of a color scale or data bar conditional formatting rule.

    Unquote

    -- Hope this helps.

    Doug Robbins - Word MVP,

    dkr[atsymbol]mvps[dot]org

    Posted via the Community Bridge

    "Peter Schleif" wrote in message news:*** Email address is removed for privacy ***...

    Doug Robbins [MVP] wrote on 8/17/2010 08:28 CEST:

    The colorindex was added by Excel 2007

    Sure? The following works fine in Excel 2002. Probably also in earlier versions.

       MsgBox [A1].Font.ColorIndex

    Peter


    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org

    0 comments No comments
  3. Anonymous
    2010-08-17T09:58:00+00:00

    Doug Robbins [MVP] wrote on 8/17/2010 08:28 CEST:

    The colorindex was added by Excel 2007

    Sure? The following works fine in Excel 2002. Probably also in earlier versions.

    MsgBox [A1].Font.ColorIndex

    Peter

    0 comments No comments
  4. Anonymous
    2010-08-17T04:46:46+00:00

    Thanks ND, a big help.  A quick follow up,

    Are the index numbers for the palette the same in xl2007 as earlier for .ColorIndex ?

    Thanks.

    0 comments No comments