+ Reply to Thread
Results 1 to 7 of 7

Interior.Color RGB Values Misaligning

  1. #1
    Forum Contributor
    Join Date
    06-14-2016
    Location
    Brookland, Arkansas
    MS-Off Ver
    2007,2021
    Posts
    129

    Interior.Color RGB Values Misaligning

    Good Afternoon,

    I have the following bit of code written to detect the interior color of a cell, break it into RGB, then change the fill of another cell to that RGB value.

    However, when double checking that it was working properly I noticed that Interior.Color of the target cell does not actually match Interior.Color of the source cell.
    Additionally, if using this code to check the RGB of a blank cell, which should come back as (255,255,255), it instead comes back as (255,0,0)

    Please Login or Register  to view this content.
    I am attaching the sheet as well, so you can see the exact test color that is not lining up.

    I am not sure what about this formula is incorrect. Other sources online confirm this approach to finding the correct RGB value.
    Attached Files Attached Files
    Who needs a life when you have Excel.

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,234

    Re: Interior.Color RGB Values Misaligning

    You used an invalid division operator. It should be the "\" operator, not the "/" operator. Read about integer division.
    In the example below, note the blank cell G8. Interior.Color returns the color white. When you apply it to cell G10 you get a white fill (the grid around cell G10 is gone). You should distinguish between a cell without a fill and a cell filled with the default color (in this case white). It seems to me that with the Color property you cannot tell if a cell has no fill. Therefore, to find out, I use the ColorIndex property.
    Please Login or Register  to view this content.
    Artik

  3. #3
    Forum Contributor
    Join Date
    06-14-2016
    Location
    Brookland, Arkansas
    MS-Off Ver
    2007,2021
    Posts
    129

    Re: Interior.Color RGB Values Misaligning

    Thank you very much. I appreciate learning the difference between those operators.

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,537

    Re: Interior.Color RGB Values Misaligning

    Good way to learn different things but this works and is easier.
    Please Login or Register  to view this content.
    Experience trumps academics every day of the week and twice on Sunday.

  5. #5
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: Interior.Color RGB Values Misaligning


    Hello,

    just a question : why breaking to RGB ? As it is very useless from cell to cell ! Or what I missed ?

  6. #6
    Forum Contributor
    Join Date
    06-14-2016
    Location
    Brookland, Arkansas
    MS-Off Ver
    2007,2021
    Posts
    129

    Re: Interior.Color RGB Values Misaligning

    Hi Marc,

    This is feeding into a larger sheet where the comparison input given will be in terms of integer values for the R, G, and B components. With the input being given in those terms, my process was to then break the visual cells down to those same components and confirm a match or, if not a match, the exact deviance on each of the RGB parameters.

    Hope this answers your question.

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Interior.Color RGB Values Misaligning


    Thanks.

    I can't see the benefit - according to the direct way like demonstrated in post #4 - except for some secret code
    according to each RGB component …

+ 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: 0
    Last Post: 01-11-2021, 03:57 PM
  2. [SOLVED] How to get interior.color to use conditional formatting color?
    By tahi.laci in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-28-2015, 12:34 PM
  3. Find a duplicate and then use the duplicates interior.color to change cell color.
    By bopsgtir in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-01-2012, 03:54 PM
  4. [SOLVED] Conditional formatting interior color from comparing two cell values VBA
    By Blue_Diamond in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-27-2012, 11:24 AM
  5. Check Conditional Formating - Interior Gradient Color Values
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-07-2012, 01:52 AM
  6. Cell background color (interior color) setting not working
    By Martin E. in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-21-2006, 02:10 PM

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