1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| Option Explicit
Sub Couleurs()
Dim Ws As Worksheet
Dim RGBc As Long
Dim B As Integer, G As Integer, R As Integer
Dim i As Long
Dim iRow As Long, iCol As Long
Dim Ar() As Variant
Set Ws = ActiveWorkbook.Worksheets.Add
With Ws
.Cells(1, 3) = "R"
.Cells(1, 4) = "G"
.Cells(1, 5) = "B"
End With
' 56 Couleurs Standards
For i = 1 To 56
With Ws
.Cells(i + 1, 1).Interior.ColorIndex = i
.Cells(i + 1, 2) = i
RGBc = .Cells(i + 1, 1).Interior.Color
R = Int(RGBc Mod 256)
G = Int((RGBc Mod 65536) / 256)
B = Int(RGBc / 65536)
.Cells(i + 1, 3) = R
.Cells(i + 1, 4) = G
.Cells(i + 1, 5) = B
.Cells(i + 1, 6) = RGBc
End With
Next i
' 40 Couleurs Disponibles dans Menu Couleur Cellules
Ar = Array(1, 53, 52, 51, 49, 11, 55, 56, _
9, 46, 12, 10, 14, 5, 47, 16, _
3, 45, 43, 50, 42, 41, 13, 48, _
7, 44, 6, 4, 8, 33, 54, 15, _
38, 40, 36, 35, 34, 37, 39, 2)
With Ws
i = 1
For iRow = 1 To 5
For iCol = 1 To 8
.Cells(iRow + 1, 6 + iCol).Interior.ColorIndex = Ar(i - 1)
.Cells(iRow + 1, 6 + iCol) = Ar(i - 1)
i = i + 1
Next iCol
Next iRow
With .Range("G2:N6")
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
.Columns("G:N").ColumnWidth = 2
.Range("O1").Select
End With
End Sub |
Partager