Return RGB values from Range.Interior.Color (or any other Color Property)

前端 未结 7 1335
无人共我
无人共我 2020-11-27 06:55

I was trying to incrementally change the background color of a cell to black, and I found that the Range.Interior.Color method returns a Long which is seemingly arbitrary.

相关标签:
7条回答
  • 2020-11-27 07:46

    Short Answer:

    There is no built in functionality for this. You must write your own function.

    Long Answer:

    The long that is returned from the Interior.Color property is a decimal conversion of the typical hexidecimal numbers that we are used to seeing for colors in html e.g. "66FF66". Additionally the constant xlNone (-4142) can be passed to set cell to have no color in the background, however such cells are marked white RGB(255, 255, 255) from the Get property. Knowing this, we can write a function that returns one or all of the appropriate RGB values.

    Luckily, a kind Mr. Allan Wyatt has done just that here!

    Determining the RGB Value of a Color

    0 讨论(0)
提交回复
热议问题