Option Explicit
Dim CVArray As Variant Sub Main()
Dim ColorR, ColorC As Integer
Dim R As Double, G As Double, B As Double
Dim K As Long
On Error Resume Next
CVArray = 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, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)
ActiveCell.Select
Cells(ActiveCell.Row + 8, ActiveCell.Column) = "ColorIndex Öµ"
For ColorR = 1 To 7
For ColorC = 1 To 8
ActiveCell.Offset((ColorR - 1), ColorC - 1).Interior.ColorIndex = CVArray((ColorR - 1) * 8 + ColorC - 1)
K = ActiveCell.Offset((ColorR - 1), ColorC - 1).Interior.Color
Cells(ActiveCell.Row + 9 + (ColorR - 1), ActiveCell.Column + ColorC - 1) = CVArray((ColorR - 1) * 8 + ColorC - 1)
R = K Mod 256
B = Int(K / 65536)
G = Int((K - (B * 65536)) / 256)
With Cells(ActiveCell.Row + (ColorR - 1), ActiveCell.Column + ColorC - 1).Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = "RGB Öµ"
.ErrorTitle = ""
.InputMessage = R & "," & G & "," & B
.ErrorMessage = ""
.IMEMode = xlIMEModeNoControl
.ShowInput = True
.ShowError = True
End With
'Cells(ActiveCell.Row + (ColorR - 1), ActiveCell.Column + 8 + ColorC - 1) = R & "," & G & "," & B
Next ColorC
Next ColorR
End Sub
|