Consulting

Results 1 to 3 of 3

Thread: Solved: colornumber in excell

  1. #1
    VBAX Contributor
    Joined
    Feb 2008
    Posts
    193
    Location

    Solved: colornumber in excell

    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

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    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
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Contributor
    Joined
    Feb 2008
    Posts
    193
    Location
    Thanks.

    Ger

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •