+ Reply to Thread
Results 1 to 9 of 9

Get code of color in cell

  1. #1
    Registered User
    Join Date
    11-26-2013
    Location
    Ljubljana, Slovenia
    MS-Off Ver
    Excel 2003
    Posts
    43

    Get code of color in cell

    Hello, I have some values in cell which are colored with different colors. I want to compare values which are colored. Now the easiest way it's to have code of color which is unique for each shade of some color (I guess), so how could I get that code/number of color.

    example: if A1 is blue then in B1 type digital number of that color and so on..

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Get code of color in cell

    Hi,

    Personally I don't think using colour code values is robust enough. Better to use whatever is driving the cell colours. If it's conditional formatting then use the CF conditions in any comparisons.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    11-26-2013
    Location
    Ljubljana, Slovenia
    MS-Off Ver
    Excel 2003
    Posts
    43

    Re: Get code of color in cell

    I can't use CF for that operation..

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Get code of color in cell

    Hi,

    I didn't say you should. I was merely trying to establish what process you were using to paint the cell colours. That's why I used the phrase 'If it's CF...'

  5. #5
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: Get code of color in cell

    To get the color index, you may try this piece of code........
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by sktneer; 04-24-2014 at 02:14 PM.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  6. #6
    Registered User
    Join Date
    11-26-2013
    Location
    Ljubljana, Slovenia
    MS-Off Ver
    Excel 2003
    Posts
    43

    Re: Get code of color in cell

    Great! That's what I need Tnx

  7. #7
    Registered User
    Join Date
    11-26-2013
    Location
    Ljubljana, Slovenia
    MS-Off Ver
    Excel 2003
    Posts
    43

    Re: Get code of color in cell

    Hmm, I found some mistakes, try different shades of grey, for 2 different shades show the same number.. also for purple..

  8. #8
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Get code of color in cell

    Quote Originally Posted by Ssaamirr View Post
    Hmm, I found some mistakes, try different shades of grey, for 2 different shades show the same number.. also for purple..
    ...exactly as I warned in post #2.

    If the cells are permanently coloured then I suggest you use a helper column which contains a code you devise that uniquely identifies the colour and use that in your code. OTOH if they are conditional formats then as I intimated, use the same logic as you use in the CF.

  9. #9
    Registered User
    Join Date
    11-26-2013
    Location
    Ljubljana, Slovenia
    MS-Off Ver
    Excel 2003
    Posts
    43

    ?

    Hmm.. I don't understand you completely, what do you mean by helper column?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 12-07-2013, 02:21 PM
  2. [SOLVED] vba code to change the cell color by looking in a range that contains the color index valu
    By ckklconner in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-24-2013, 09:15 AM
  3. Fill Cell with Color from Shape's color code
    By excelnewbie80 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-02-2012, 05:34 PM
  4. Color code cell with case statement and datestamp cell(s) to the left
    By garricko in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-26-2010, 08:37 PM
  5. Code: Cell color
    By daveri in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-07-2009, 08:45 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1