Excel – Automatically filling colors as per the values in the cell in spreadsheet

microsoft excelspreadsheet

Question : Is it possible to fill each cell in a spreadsheet with a color whose grayscale value is same as cell value?

Explanation :

Consider I have a spreadsheet as follows :

enter image description here

All values lie between 0-255 ( which corresponds to 256 grayscale colors). Now I want to fill will each cell with the color whose value is the value in the cell. So expected output is as follows :

enter image description here

Also, see that font color in each cell is either black or white corresponding to the background color.

Is there any simple method in Excel to perform this in a very few steps or all at once ?

Best Answer

Create a Macro that iterates through your cells, reads the value in the cell and assigns it to the color like this:

Range("A1:A6").Interior.Color = RGB(200,160,35)