+ Reply to Thread
Results 1 to 6 of 6

Background fill RGB color depending on the 3 input cells R,G and B?

  1. #1
    Registered User
    Join Date
    03-27-2013
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2010
    Posts
    3

    Question Background fill RGB color depending on the 3 input cells R,G and B?

    Hello,

    I have 4 cells in excel.
    cell 1 contains the R-value of the RGB color.
    cell 2 contains the G-value of the RGB color
    cell 3 contains the B-value of the RGB color

    Now i want the background fill of the 4th cell to be the RGB color specified by the values in the 3 other cells.
    Can this be done by a formula or macro? I do not want to do this manually.

    I attached an example excel file.

    , thx for your advice

    _Chebu
    Attached Files Attached Files
    Last edited by Chebu; 03-28-2013 at 06:46 AM.

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Background fill RGB color depending on the 3 input cells R,G and B?

    Perhaps a macro like this?

    Please Login or Register  to view this content.
    or this could also be used

    Please Login or Register  to view this content.
    instead of Cells command.

    Alf
    Last edited by Alf; 03-27-2013 at 04:24 PM. Reason: more options

  3. #3
    Registered User
    Join Date
    03-27-2013
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Background fill RGB color depending on the 3 input cells R,G and B?

    Hi,

    Thx Alf it works now. I used the macro, the other one did not work. I pasted the formula above without using the equal sign.
    I would like to have 2 extra functionalities:

    1) The macro should do this for 20 rows, so I would need some sort of loop.
    2) The macro should run automatically if a cell is changed in the R, G or B columns.

    I added the previous solution with the macro included. The macro runs with "ctrl+p".

    Colors v3.xlsm

    ,Thx dor your help

    _Chebu

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Background fill RGB color depending on the 3 input cells R,G and B?

    What you need for your last request is a macro that fires on a "Worksheet_Change" event so a code like this should fulfil both your needs.

    Please Login or Register  to view this content.
    To add the code do as follows. Right click on the tab "CustomColorMap" then click "View Code" and paste this macro in the windows that opens.

    Alf

  5. #5
    Registered User
    Join Date
    03-27-2013
    Location
    Antwerp, Belgium
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Background fill RGB color depending on the 3 input cells R,G and B?

    Hi Alf,

    It is Working perfect.

    ,Thx

  6. #6
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Background fill RGB color depending on the 3 input cells R,G and B?

    Glad to be of help and thanks for feed back.

    Alf

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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