View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 293
Default Generating an RGB color spectrum based on cell values (XL03)

Hi CellShocked,

Somehow I think that's 'right over the top' as far as a solution to the OP's problem goes. Even mine is perhaps more elaborate than
necessary ...

--
Cheers
macropod
[Microsoft MVP - Word]


"CellShocked" <cellshocked@thecellvalueattheendofthespreadsheet. org wrote in message
...
On Sat, 20 Feb 2010 18:09:26 +1100, "macropod"
wrote:

Hi ker,

Here's something to get you started:
Sub ColorIt()
Dim oCel As Range, iRed As Integer, iBlu As Integer, iGrn As Integer
For Each oCel In ActiveSheet.UsedRange.Cells
With oCel
.Interior.ColorIndex = xlColorIndexNone
If .Offset(0, 1).Value = .Value + 1 Then
iRed = .Column * .Value * 31 Mod 256
iGrn = 256 - .Column * .Value * 31 Mod 256
iBlu = .Value * 127 Mod 256
.Interior.Color = RGB(iRed, iGrn, iBlu)
End If
End With
Next
End Sub



I DLd a sheet/book somewhere with the entire (maybe) pantone/rgb table
and colored cells on it, but automating it would be cool too!

It would be cool to see a workbook like this:

Give a range or a preference for one of the three basic colors, and a
sheet gets generated with colored cells, and their numeric criteria
written in the cell, or under it. Because we cannot get them all on one
sheet.

Better still, put up the range of colors graphic 3D plot and plot the
point of your selection within the graph. The graph I refer to is the
CIE 1931 Chromaticity Diagram. Paste it as the background under your
chart, properly scaled and registered.

http://upload.wikimedia.org/wikipedi...agram_full.pdf

or the like.