View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Dynamic interior colors


Cell D1 will display the rgb color if you enter integers in A1, B1, C1.
Place this code in the Sheet module...
'--
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Intersect(Target(1, 1), Me.Range("A1:C1")) Is Nothing Then
Dim N As Long
For N = 1 To 3
If Not IsNumeric(Me.Cells(1, N)) Then Exit Sub
Next
Me.Parent.Colors(54) = _
RGB(Me.Range("A1").Value, Me.Range("B1").Value, Me.Range("C1").Value)
Me.Range("D1").Interior.ColorIndex = 54
End If
End Sub
'--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"RobL"
wrote in message
This is probably a simple answer, but I cannot see it.
I have four cells, A1, B1, C1 and D1. What I would like to do is to have a
funtion so that when values are entered into A1(Red), B1(Green), and
C1(Blue), the interior color of D1 would correspond to the RGB values
entered.
Is there such a beast where I could type into cell D1, =RGB(A1, B1, C1) ?
If not how would I go about creating such a function?