PDA

View Full Version : Solved: colornumber in excell



Ger
02-13-2008, 01:54 AM
I use Excell 2003. I have a macro which gives a color to a value. Where can i find which number belongs to a color. Now i do it with try and error.
example number 56 gives the color dark grey number 6 gives the color yellow.

Ger

Sub kleur()
For rij = 147 To 230
For kolom = 1 To 185
inkleuren rij, kolom
Next
Next
End Sub
Sub inkleuren(r, c)
Cells(r, c).Interior.ColorIndex = Kleurbepalen(Cells(r, c).Value)
Cells(r, c).Font.ColorIndex = Kleurbepalen(Cells(r, c).Value)
End Sub
Function Kleurbepalen(kleurwaarde)
Select Case kleurwaarde
Case 131
Kleurbepalen = 56
Case 132
Kleurbepalen = 11
Case 133
Kleurbepalen = 50
Case 134
Kleurbepalen = 13
Case 135
Kleurbepalen = 10
Case 136
Kleurbepalen = 9
Case 137
Kleurbepalen = 3
Case 138
Kleurbepalen = 4
Case 139
Kleurbepalen = 5
Case 140
Kleurbepalen = 6
Case 141
Kleurbepalen = 7
Case 142
Kleurbepalen = 8
Case 143
Kleurbepalen = 22
Case 144
Kleurbepalen = 16
End Select
End Function

Bob Phillips
02-13-2008, 02:39 AM
Sub ShowColours()
Dim i As Long

For i = 1 To 56

Cells(i, "A").Value = i
Cells(i, "B").Interior.ColorIndex = i
Next i
End Sub

Ger
02-13-2008, 03:09 AM
Thanks.

Ger