Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set background colour of cell to RGB value of data in cell

Tags:

excel

rgb

vba

I have a column containing RGB values, e.g.:

127,187,199 67,22,94 

In Excel, is there any way I can use this to set the background colour of the cell?

like image 291
Internet man Avatar asked Sep 15 '09 10:09

Internet man


People also ask

How do you make a cell change color based on data?

On the Home tab, in the Style group, click the arrow next to Conditional Formatting, and then click Highlight Cells Rules. Select the command you want, such as Between, Equal To Text that Contains, or A Date Occurring. Enter the values you want to use, and then select a format.

Can you make a cell change Colour depending on value?

In the example above, you are changing the cell color based on that cell value only. You can also change the cell color based on other cells value as well. Suppose you want to change the color of cell E3 based on the value in D3. To do that, you have to use the formula in conditional formatting.


1 Answers

You can use VBA - something like

Range("A1:A6").Interior.Color = RGB(127,187,199) 

Just pass in the cell value.

like image 141
Galwegian Avatar answered Oct 09 '22 07:10

Galwegian