1. Welcome to Chandoo.org Forums. Short message for you

    Hi Guest,

    Thanks for joining Chandoo.org forums. We are here to make you awesome in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings.

    Yours,
    Chandoo
  2. Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  3. When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Looking for color chart

Discussion in 'Ask an Excel Question' started by Eloise T, Jan 15, 2019.

  1. Eloise T

    Eloise T Active Member

    Messages:
    851
    Red is equal to all the following: -16776961 vbRed RGB(255, 0, 0)

    I'm looking for a chart that lists the other colors like -16776961 and
    a similar chart for "vb" colors.

    Thank you.
  2. vletm

    vletm Excel Ninja

    Messages:
    4,805
    Could this help?
    Screenshot 2019-01-15 at 22.40.04.png
  3. Eloise T

    Eloise T Active Member

    Messages:
    851
    I need to be able to look up a number like -16776961 and determine it's red.

    Where is the drop-down window in Excel in your picture above?
  4. Peter Bartholomew

    Peter Bartholomew Well-Known Member

    Messages:
    648
    I do not know of a chart but it is reasonably easy to write a macro that will colour a shape to conform to a specified value (often quoted as Hex numbers "0000FF" - red for example). Conversely, if you have a coloured shape you can return its RGB value.

    Code (vb):
    Sub Hexagon1_Click()
    Dim shp As Shape
    Dim shpName
    Dim Color
    shpName = Application.Caller
    Set shp = ActiveSheet.Shapes(shpName)
    Color = Range("Color").Value
    shp.Fill.ForeColor.RGB = Color
    End Sub
    or

    Code (vb):
    Sub Hexagon1_Test()
    Dim shp As Shape
    Dim shpName
    Dim Color
    shpName = "Hexagon 1"
    Set shp = ActiveSheet.Shapes(shpName)
    Color = shp.Fill.ForeColor.RGB
    Range("Color").Value = Color
    End Sub
    Your number, when converted to Hex, has a leading FFFF before the 00 (blue) 00 (green) FF (red). That makes it convert to a negative decimal number but I do not know what it does in terms of the colour.
  5. Eloise T

    Eloise T Active Member

    Messages:
    851
    You put a knife in the hands of a two-year old. I'm the two-year old.
    Before I try all kinds of substitutions, how do I implement either of the macros?
  6. AlanSidman

    AlanSidman Active Member

    Messages:
    446
  7. Eloise T

    Eloise T Active Member

    Messages:
    851
    Thanks. I've seen that, however. I'm looking specifically for a chart that lists the other colors like -16776961 ...which in this case is red. That's the only one I have.
  8. Eloise T

    Eloise T Active Member

    Messages:
    851
  9. vletm

    vletm Excel Ninja

    Messages:
    4,805
    Eloise T
    Who knows is that only from Apple?
    Have You tried to select eg background color with any Excel?
    > For me, there is 'More colors...' and
    after that there are many possibilities to work with those.

    Where have You find that -16776961 is as RBG(255,0,0)?
  10. Chihiro

    Chihiro Excel Ninja

    Messages:
    5,246
    vbRed should be 3.

    VB color constants are listed in link below.
    https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/color-constants

    You can easily create your own conversion for these constants.
    Code (vb):
    Sub Demo()
    Dim ar
    ar = Array(vbBlack, vbRed, vbGreen, vbYellow, vbBlue, vbMagenta, vbCyan, vbWhite)
    For i = LBound(ar) To UBound(ar)
        Cells(i + 1, "A").Interior.Color = ar(i)
        Cells(i + 1, "B").Value = Cells(i + 1, "A").Interior.ColorIndex
    Next
    End Sub
    For RGB have a read of link below.
    https://excelribbon.tips.net/T010180_Determining_the_RGB_Value_of_a_Color.html
    Thomas Kuriakose likes this.
  11. Peter Bartholomew

    Peter Bartholomew Well-Known Member

    Messages:
    648
    This is not a chart but it allows you to input a hex number and apply it to a shape or the reverse (the original shape colours were washed out because they were set to 50% transparency :oops:)

    Attached Files:

    Last edited: Jan 16, 2019
    Eloise T and Thomas Kuriakose like this.
  12. Eloise T

    Eloise T Active Member

    Messages:
    851
    My "More colors" looks like these two pictures:
    upload_2019-1-16_13-40-0.png
    upload_2019-1-16_13-40-54.png

    I don't know where I found -16776961 is as RBG(255,0,0)
    All I do know is that -16776961 works as a replacement for
    RBG(255,0,0) or vbRed. Hence the desire to find the "hard
    to find" chart or table.
  13. Eloise T

    Eloise T Active Member

    Messages:
    851
    Interesting that the -16776961 turns out to be decimal equivalent to FFFF0000FF. That number is making more sense...not completely, but more. :)
  14. vletm

    vletm Excel Ninja

    Messages:
    4,805
    Eloise T
    Your 'Custom' is as same as mine only Hex-value is missing.
    Red ~ RGB(255,0,0) ~ #FF0000
    FFFF0000FF .. hmm? but with which rule?
  15. Eloise T

    Eloise T Active Member

    Messages:
    851
    I have now learned that -16776961 was converted from HEX FFFF0000FF.
    ...and I'll keep hunting until I find a good answer.
  16. vletm

    vletm Excel Ninja

    Messages:
    4,805
  17. Peter Bartholomew

    Peter Bartholomew Well-Known Member

    Messages:
    648
    vletm
    Agreeing most of the way but I think you have highlighted the wrong part of the hex string.
    I believe the highlight should be applied to the final six characters.
    FFFF 00 00 FF
    The final (least significant) two control red, the next two control green and the most significant control blue. What I do not know is the significance to the first four characters (16 bits). It seems that filling the sequence with 0 or 1 is OK and gives the same colour but other values crash VBA.
  18. Eloise T

    Eloise T Active Member

    Messages:
    851
    I agree.
  19. vletm

    vletm Excel Ninja

    Messages:
    4,805
    Peter Bartholomew
    I highlighted same part which means for me Red ~ FF0000;
    with question: but with which rule?
    Without clear rule,
    no matter of thinking or believe this could be whatever.
    Eg:

    I also found one page, which shows that -16776961 is Aqua-color.
    Screenshot 2019-01-17 at 09.59.50.png
    That was so clear!
    Of course, there are also page, that it would use for red-color too.

    I use RGB(255,0,0) for 'red'; and there are many red-colors.
  20. Peter Bartholomew

    Peter Bartholomew Well-Known Member

    Messages:
    648
    vletm
    The code -16776961 (FFFF0000FF) definitely gives Red on a PC, as does 255 (FF).
    I agree that the RGB function is clearer to read though working with Hex representation is not that difficult. For example 0080FF, RGB(0, 127, 255) gives orange, as does FFFF0080FF. The decimal equivalents are pretty unintelligible.

    Eloise
    If you were keen to have a chart, you are now in a position to create your own, maybe colouring cell interiors rather than shapes. If you want 'poetic' names for the colours, such as Pantone "Fuchsia Rose" or "Tangerine Tango" that is another kettle of fish! :)
  21. Peter Bartholomew

    Peter Bartholomew Well-Known Member

    Messages:
    648
    Just to 'put my money where my mouth is'
    (with apologies to non-native English speakers).

    Code (vb):
    Sub ColorCells()
    Dim c As Range
        For Each c In [Decimal]
            c.Offset(0, 1).Interior.Color = c.Value
        Next c
    End Sub
    Instructions: Click 'Color' heading to recolour black cells.

    Attached Files:

    Thomas Kuriakose likes this.

Share This Page