hello
I want to convert a matrix of results in decimal or real number into a
spectrum of colors (or grey scale if it's not possible) to make a "picture"
it's quiet urgent so a great thanks to who will success the challenge!
hello
I want to convert a matrix of results in decimal or real number into a
spectrum of colors (or grey scale if it's not possible) to make a "picture"
it's quiet urgent so a great thanks to who will success the challenge!
Here is one way
Private Const xlCIBlack As Long = 1
Private Const xlCIWhite As Long = 2
Private Const xlCIRed As Long = 3
Private Const xlCIBrightGreen As Long = 4
Private Const xlCIBlue As Long = 5
Private Const xlCIYellow As Long = 6
Private Const xlCIPink As Long = 7
Private Const xlCITurquoise As Long = 8
Private Const xlCIDarkRed As Long = 9
Private Const xlCIGreen As Long = 10
Private Const xlCIDarkBlue As Long = 11
Private Const xlCIDarkYellow As Long = 12
Private Const xlCIViolet As Long = 13
Private Const xlCITeal As Long = 14
Private Const xlCIGray25 As Long = 15
Private Const xlCIGray50 As Long = 16
Private Const xlCIPeriwinkle As Long = 17
Private Const xlCIPlum As Long = 18
Private Const xlCIIvory As Long = 19
Private Const xlCILightTurquoise As Long = 20
Private Const xlCIDarkPurple As Long = 21
Private Const xlCICoral As Long = 22
Private Const xlCIOceanBlue As Long = 23
Private Const xlCIIceBlue As Long = 24
Private Const xlCISkyBlue As Long = 33
Private Const xlCILightGreen As Long = 35
Private Const xlCILightYellow As Long = 36
Private Const xlCIPaleBlue As Long = 37
Private Const xlCIRose As Long = 38
Private Const xlCILavender As Long = 39
Private Const xlCITan As Long = 40
Private Const xlCILightBlue As Long = 41
Private Const xlCIAqua As Long = 42
Private Const xlCILime As Long = 43
Private Const xlCIGold As Long = 44
Private Const xlCILightOrange As Long = 45
Private Const xlCIOrange As Long = 46
Private Const xlCIBlueGray As Long = 47
Private Const xlCIGray40 As Long = 48
Private Const xlCIDarkTeal As Long = 49
Private Const xlCISeaGreen As Long = 50
Private Const xlCIDarkGreen As Long = 51
Private Const xlCIBrown As Long = 53
Private Const xlCIIndigo As Long = 55
Private Const xlCIGray80 As Long = 56
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
On Error GoTo ws_exit
Application.EnableEvents = False
For Each cell In Target
Select Case cell.Value
Case "r": cell.Interior.ColorIndex = xlCIRed
Case "b": cell.Interior.ColorIndex = xlCIBlue
Case "g": cell.Interior.ColorIndex = xlCIGreen
Case "y": cell.Interior.ColorIndex = xlCIYellow
End Select
Next cell
ws_exit:
Application.EnableEvents = True
End Sub
This is worksheet event code, which means that it needs to be
placed in the appropriate worksheet code module, not a standard
code module. To do this, right-click on the sheet tab, select
the View Code option from the menu, and paste the code in.
--
HTH
Bob Phillips
(remove nothere from the email address if mailing direct)
"Patbil" <patbil78@wanadoo.fr> wrote in message
news:43ebb526$0$20155$8fcfb975@news.wanadoo.fr...
> hello
> I want to convert a matrix of results in decimal or real number into a
> spectrum of colors (or grey scale if it's not possible) to make a
"picture"
> it's quiet urgent so a great thanks to who will success the challenge!
Hi Bob,
What about
Private Enum xlCI: xlCIBlack = 1: xlCIWhite: xlCIRed: xlCIBrightGreen:
xlCIBlue
: xlCIYellow: xlCIPink: xlCITurquoise: xlCIDarkRed: xlCIGreen
: xlCIDarkBlue: xlCIDarkYellow: xlCIViolet: xlCITeal: xlCIGray25
: xlCIGray50: xlCIPeriwinkle: xlCIPlum: xlCIIvory: xlCILightTurquoise
: xlCIDarkPurple: xlCICoral: xlCIOceanBlue: xlCIIceBlue
: xlCISkyBlue = 33
: xlCILightGreen = 35: xlCILightYellow: xlCIPaleBlue: xlCIRose:
xlCILavender: xlCITan
: xlCILightBlue: xlCIAqua: xlCILime: xlCIGold: xlCILightOrange
: xlCIOrange: xlCIBlueGray: xlCIGray40: xlCIDarkTeal: xlCISeaGreen
: xlCIDarkGreen: xlCIBrown = 53: xlCIIndigo = 55: xlCIGray80
End Enum
?
Regards,
Bernd
Hi Bernd,
Yes you could certainly do that, but I didn't for two reasons.
Enums have too many restrictions for my taste. If you don't assign a value,
as you haven't in many cases, you cannot intuitively see their value, so you
really need to assign values IMO.
Enums are great to declare a type, but as I didn't want to use the type
xlCI, it had no extra benefit.
They do look good though <G>
Bob
<bplumhoff@gmail.com> wrote in message
news:1139563690.282039.21660@f14g2000cwb.googlegroups.com...
> Hi Bob,
>
> What about
>
> Private Enum xlCI: xlCIBlack = 1: xlCIWhite: xlCIRed: xlCIBrightGreen:
> xlCIBlue
> : xlCIYellow: xlCIPink: xlCITurquoise: xlCIDarkRed: xlCIGreen
> : xlCIDarkBlue: xlCIDarkYellow: xlCIViolet: xlCITeal: xlCIGray25
> : xlCIGray50: xlCIPeriwinkle: xlCIPlum: xlCIIvory: xlCILightTurquoise
> : xlCIDarkPurple: xlCICoral: xlCIOceanBlue: xlCIIceBlue
> : xlCISkyBlue = 33
> : xlCILightGreen = 35: xlCILightYellow: xlCIPaleBlue: xlCIRose:
> xlCILavender: xlCITan
> : xlCILightBlue: xlCIAqua: xlCILime: xlCIGold: xlCILightOrange
> : xlCIOrange: xlCIBlueGray: xlCIGray40: xlCIDarkTeal: xlCISeaGreen
> : xlCIDarkGreen: xlCIBrown = 53: xlCIIndigo = 55: xlCIGray80
> End Enum
>
> ?
>
> Regards,
> Bernd
>
Hi Bob,
I see your point.
But I like it <G>
Private Enum xlCI 'Excel Color Index
: xlCIBlack = 1: xlCIWhite: xlCIRed: xlCIBrightGreen: xlCIBlue '1 - 5
: xlCIYellow: xlCIPink: xlCITurquoise: xlCIDarkRed: xlCIGreen '6 - 10
: xlCIDarkBlue: xlCIDarkYellow: xlCIViolet: xlCITeal: xlCIGray25 '11 -
15
: xlCIGray50: xlCIPeriwinkle: xlCIPlum: xlCIIvory: xlCILightTurquoise
'16 - 20
: xlCIDarkPurple: xlCICoral: xlCIOceanBlue: xlCIIceBlue: xlCILightBrown
'21 - 25
: xlCIMagenta2: xlCIYellow2: xlCICyan2: xlCIDarkPink: xlCIDarkBrown '26
- 30
: xlCIDarkTurquoise: xlCISeaBlue: xlCISkyBlue: xlCILightTurquoise2:
xlCILightGreen '31 - 35
: xlCILightYellow: xlCIPaleBlue: xlCIRose: xlCILavender: xlCITan '36 -
40
: xlCILightBlue: xlCIAqua: xlCILime: xlCIGold: xlCILightOrange '41 - 45
: xlCIOrange: xlCIBlueGray: xlCIGray40: xlCIDarkTeal: xlCISeaGreen '46
- 50
: xlCIDarkGreen: xlCIGreenBrown: xlCIBrown: xlCIDarkPink2: xlCIIndigo
'51 - 55
: xlCIGray80 '56
End Enum
Regards,
Bernd
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks