或輸入以下的編碼
Sub ListColor()
Dim r As Double, g As Double, b As Double
Dim k As Long
Range("A1") = "ColorIndex 值"
Range("B1") = "色 卡"
Range("C1") = "RGB 值"
Range("D1") = "色 卡"
For i = 1 To 56
Range("A" & i + 1) = i
Range("B" & i + 1).Interior.ColorIndex = i
k = Range("B" & i + 1).Interior.Color
r = k Mod 256
b = Int(k / 65536)
g = Int((k - (b * 65536)) / 256)
Range("C" & i + 1) = r & "," & g & "," & b
Range("D" & i + 1).Interior.Color = RGB(r, g, b)
Next
With Range("A1").CurrentRegion
.EntireColumn.AutoFit
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
End Sub
沒有留言:
張貼留言