Hi,
can you pls help me with improving my VBA code. the goal is to:
- make excel automatically change cell colors in column D, according to RGB values in column A, B and C
- I want it to be automatic - every time you fill cells in columns A:C, cell in column D will change color based on RGB values
- I do not want it to delate date written in cell in column D
I have managed to make below code, however I need to make it for every row separately.
example RGB values:
<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>
</tbody>
can you pls help me with improving my VBA code. the goal is to:
- make excel automatically change cell colors in column D, according to RGB values in column A, B and C
- I want it to be automatic - every time you fill cells in columns A:C, cell in column D will change color based on RGB values
- I do not want it to delate date written in cell in column D
I have managed to make below code, however I need to make it for every row separately.
Code:
Sub color()
Dim R As Integer, G As Integer, B As Integer
R = ActiveCell.Offset(0, -3).Value
G = ActiveCell.Offset(0, -2).Value
B = ActiveCell.Offset(0, -1).Value
Range("d1:d20").Interior.color = RGB(R, G, B)
End Sub
example RGB values:
245 | 238 | 242 |
32 | 4 | 22 |
150 | 150 | 149 |
253 | 205 | 203 |
255 | 150 | 134 |
107 | 161 | 104 |
203 | 59 | 28 |
<colgroup><col width="64" span="3" style="width:48pt"> </colgroup><tbody>
</tbody>