ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[¤À¨É] Colorindexªº¨Ï¥Î¦Cªí, ºô¸ô·j¨ì, ½Ð°Ñ¾\.

[¤À¨É] Colorindexªº¨Ï¥Î¦Cªí, ºô¸ô·j¨ì, ½Ð°Ñ¾\.

¥»©«³Ì«á¥Ñ mmxxxx ©ó 2014-11-10 18:20 ½s¿è

¦]¤u§@¼¶¼gSPC¹Ïªí, ÃC¦âÅܤƥi¼W¥[Åã¥Ü®ÄªG.ColorIndexªº¨Ï¥Î.
¦p¤U¬°ºô¸ô·j¨ì, ·Pı¤£¿ù, ¤À¨É¤j®a.

Sub colors56()
'57 colors, 0 to 56

Dim i As Long
Dim str0 As String, str As String
Cells(1, 1) = "Interior"
Cells(1, 2) = "Font"
Cells(1, 3) = "HTML"
Cells(1, 4) = "RED"
Cells(1, 5) = "GREEN"
Cells(1, 6) = "BLUE"
Cells(1, 7) = "COLOR"


For i = 0 To 56
    Cells(i + 2, 1).Interior.ColorIndex = i  
    Cells(i + 2, 2).Font.ColorIndex = i
    Cells(i + 2, 2).Value = "[Color " & i & "]"
    str0 = Right("000000" & Hex(Cells(i + 2, 1).Interior.Color), 6)
    'Excel shows nibbles in reverse order so make it as RGB
   str = Right(str0, 2) & Mid(str0, 3, 2) & Left(str0, 2)
    'generating 2 columns in the HTML table
   Cells(i + 2, 3) = "#" & str
    Cells(i + 2, 4).Formula = "=Hex2dec(""" & Right(str0, 2) & """)"
    Cells(i + 2, 5).Formula = "=Hex2dec(""" & Mid(str0, 3, 2) & """)"
    Cells(i + 2, 6).Formula = "=Hex2dec(""" & Left(str0, 2) & """)"
    Cells(i + 2, 7) = "[Color " & i & "]"
Next i
End Sub

¸É¥R:
MS Office 2007¥H¤W, ÃC¦âÅܤƧó¦h¤F.
¦p¤U, ¥i¦Û¤wª±ª±¬Ý:
Sub change_palette_color
    dim color_index as long
    color_index = 10
    ActiveWorkbook.Colors(color_index) = RGB(128, 128, 128)
End sub

Sub test_color()
For i = 1 To 256
    Cells(i, 1).Interior.Color = RGB(i, i, i)
Next i
End Sub

Sub test_color()
For i = 1 To 256
    Cells(i, 1).Interior.ThemeColor = xlThemeColorAccent1
    Cells(i, 1).Interior.TintAndShade = (i * 2 - 256) / 256
Next i
End Sub

TOP

        ÀR«ä¦Û¦b : ·R¤£¬O­n¨D¹ï¤è¡A¦Ó¬O­n¥Ñ¦Û¨­ªº¥I¥X¡C
ªð¦^¦Cªí ¤W¤@¥DÃD