Sub AddColor()
For Each cell In Selection
R = Round(cell.Value)
G = Round(cell.Offset(0, 1).Value)
B = Round(cell.Offset(0, 2).Value)
Cells(cell.Row, 1).Resize(1, 4).Interior.Color = RGB(R, G, B)
Next cell
End Sub
Assuming that there are 3 columns R, G and B (in this order). Select first column ie R. press alt+F11 and run the above code. We have to select the first column (containing R or red values) and run the code every time we change the values to reflect the changes.
I hope this simpler code helps !