You will have to use VBA for this, test the code below for cell A1:
Range("A1").Interior.Color = RGB(127,187,199)
If you want to do this for all cells, you need to use the Worksheet_Change function of all worksheets something like:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim clrCor As Long
Dim arrCores() As String
arrCores = Split(Target.Text, ",")
clrCor = RGB(CInt(arrCores(0)), CInt(arrCores(1)), CInt(arrCores(2)))
Target.Interior.Color = clrCor
End Sub
Issue 1
Responding to the comment below ...
If you have predefined colors in a table, you can do this conditional formatting (with defined color limitations). Something like:
| Tabela de Cores |
| Azul |
| Vermelho |
| Verde |
In this table you will create a predefined list (eg lstCor).
In the table you want to format conditionally, it will put cell validation with list. So that the choice is always within the options already defined.
In your conditional formatting will link the value gives the active cell, and as the Blue result will format with the Blue, in this case you will need to have a formatting rule for each color you registered. >
Here has an advanced formatting template with data table , as explained.
If you have questions on how to do list and validation, click here .
Note :
This same idea of using tables could be extended by using a
table with all RGB colors. Only that:
The combination of values in the table will be huge (256³ items in the list);
Because conditional formatting requires that the color be manually specified in a rule, the number of rules will also be huge (similarly,
2563 rules);
That is, it is simpler and easier to do in VBA.
Issue 2
I tested the VBA formula and updated to work correctly, remembering that you should do some testing with Target.text because if it does not contain the desired format will result in an error.
I hope I have helped!