Fill color based on RGB
Maybe this,
Right click the sheet tab, view code and paste this in and run it
Sub stantive_agreement()
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set myrange = Range("A1:A" & lastrow)
For Each c In myrange
red = c.Value
green = c.Offset(0, 1).Value
blue = c.Offset(0, 2).Value
c.Offset(0, 3).Interior.Color = RGB(red, green, blue)
Next
End Sub
Mike
"ADK" wrote:
A beginner at this vba stuff. Looking to color a cell based on RGB values
Column A has the R numbers
Column B has the G numbers
Column C has the B numbers
Column D will be the where the cells fill color is based on the values
entered in columns A thru C. I'll have 256 rows ...each row will end up
having a different fill color based on the values
Example
A1=255
B1=255
C1=0
D1={cell fill color would be yellow}
A2=255
B2=191
C2=0
D2={cell fill color would be orange}
Thanks in advance for your help!
ADK
|