佛山小老鼠 发表于 2012-10-3 19:10
这是56色原贴的代码
http://club.excelhome.net/thread-927286-1-1.html - Sub 颜色与数字对照表()
- [A1:J30].Clear
- Dim i As Integer, MyColor As Variant, k As Integer, h As Integer
- MyColor = Array("黑色", "白色", "红色", "鲜绿色", "蓝色", "黄色", "粉红色", "青绿色", "深红色", "绿色", "深蓝色", "深黄色", "紫罗兰", "青色", "灰-25%", "灰-50%", "海螺色", "梅红色", "象牙色", "浅青绿", "深紫色", "珊瑚红", "海蓝色", "冰蓝", "深蓝色", "粉红色", "黄色", "青绿色", "紫罗兰", "深红色", "青色", "蓝色", "天蓝色", "浅青绿", "浅绿色", "浅黄色", "淡蓝色", "玫瑰红", "淡紫色", "茶色", "浅蓝色", "水绿色", "酸橙色", "金色", "浅橙色", "橙色", "蓝-灰", "灰-40%", "深青", "海绿", "深绿", "橄榄色", "褐色", "梅红色", "靛蓝", "灰-80%")
- MyEColor = Array("Black", "White", "Red", "Bright Green", "Blue", "Yellow", "Pink", "Turquoise", "Dark Red", "Green", "Dark Blue", "Dark Yellow", "Violet", "Teal", "Gray-25%", "Gray-50%", "Periwinkle", "Plum+", "Ivory", "Lite Turquoise", "Dark Purple", "Coral", "Ocean Blue", "Ice Blue", "Dark Blue+", "Pink+", "Yellow+", "Turquoise+", "Violet+", "Dark Red+", "Teal+", "Blue+", "Sky Blue", "Light Turquoise", "Light Green", "Light Yellow", "Pale Blue", "Rose", "Lavender", "Tan", "Light Blue", "Aqua", "Lime", "Gold", "Light Orange", "Orange", "Blue-Gray", "Gray-40%", "Dark Teal", "Sea Green", "Dark Green", "Olive Green", "Brown", "Plum", "Indigo", "Gray-80%")
- Range("A1:J30").Font.Size = 14
- Range("A1:J30").Font.Name = "楷体_GB2312"
- Range("A2:J2").Font.Size = 14
- Range("A2:J2").Font.ColorIndex = 5
- ' Range("A2:J2").Font.Bold = True
- [A1].Font.Size = 26
- [A1].Font.Bold = True
- [A1].Font.ColorIndex = 3
- [A2:J2] = Array("颜色显示", "颜色名", "数字值", "英文名", "RGB值", "颜色显示", "颜色名", "数字值", "英文名", "RGB值")
- k = 3
- h = 0
- For i = 1 To 28
- Cells(k, 1).Interior.ColorIndex = i '颜色
- Cells(k, 2) = MyColor(h) '颜色名
- Cells(k, 3) = i '颜色值
- Cells(k, 4) = MyEColor(h) '英文名
- c1 = Cells(k, 1).Interior.Color
- r1 = c1 Mod 256
- g1 = (c1 - r1) / 256 Mod 256
- b1 = (c1 - r1 - g1 * 256) / 256 ^ 2
- Cells(k, 5) = r1 & "," & g1 & "," & b1
- Cells(k, 6).Interior.ColorIndex = i + 28 '颜色
- Cells(k, 7) = MyColor(h + 28) '颜色名
- Cells(k, 8) = i + 28 '颜色值
- Cells(k, 9) = MyEColor(h + 28) '英文名
- c2 = Cells(k, 6).Interior.Color
- r2 = c2 Mod 256
- g2 = (c2 - r2) / 256 Mod 256
- b2 = (c2 - r2 - g2 * 256) / 256 ^ 2
- Cells(k, 10) = r2 & "," & g2 & "," & b2
- k = k + 1
- h = h + 1
- Next i
- [A1] = "颜色值对照表"
- Columns("A:J").HorizontalAlignment = xlLeft
- Range("A1:J1").HorizontalAlignment = xlCenterAcrossSelection
- Columns("A:J").EntireColumn.AutoFit
- End Sub
复制代码 |