Results 1 to 2 of 2

Thread: Excel VBA Interior.ColorIndex issue

  1. #1

    Thread Starter
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,439

    Excel VBA Interior.ColorIndex issue

    I have a question for any Excel guru who may know the answer, regarding Interior.ColorIndex values.

    If I change a cell background color to the Green that is available from the Excel Ribbon color selector, and then use VBA to get the ColorIndex value, it returns 14. However, if I set a cell Interior.ColorIndex value to 14, I do NOT get the same shade of Green. An index value of 10 is closer, but still not quite the same. If anyone can explain why the returned value will not generate the same color when used to set another cell, or if anyone knows what index value to use to get the same Green that I can select manually, that information would be most helpful. Note also that Red and Yellow do not have this issue.

    Links I have found:

    http://dmcritchie.mvps.org/excel/colors.htm

    https://www.excelmojo.com/colorindex-vs-color-in-vba/

    https://www.reddit.com/r/excel/comme...for_different/

    https://www.reddit.com/r/excel/comme...a_color_in_ms/

    https://stackoverflow.com/questions/...hat-is-visible


    Thanks.

  2. #2

    Thread Starter
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,439

    Re: Excel VBA Interior.ColorIndex issue

    After some research, it appears that the solution to this issue would be to use the Interior.Color property instead of the Interior.ColorIndex property. That appears to work correctly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width