Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm trying to make a sheet that shows all the possible cell fill
colors available in Excel. I'm using Excel 2002, SP3. The code I made is as follows - Sub colors() Dim i As String i = 1 a = 1 Do Until a = 65536 Rows(a).Interior.Color = i i = i + 10 a = a + 1 Loop End Sub I switched the i loop to go up by 10 because I wasn't getting any good variety in colors, only red black and maroon. Even after switching to intervals of 10 I'm still only getting reds yellows and greens along with blacks... I know there should be some blues and purples. Anyone have any ideas? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Cell interior colors in XL2002 are limited to one of the 56-color
palette options. If you try to use a color not in the palette it will just get mapped (not sure exactly how) to the nearest match. Tim On Jan 12, 12:38*pm, Matthew Dyer wrote: I'm trying to make a sheet that shows all the possible cell fill colors available in Excel. I'm using Excel 2002, SP3. The code I made is as follows - Sub colors() Dim i As String i = 1 a = 1 Do Until a = 65536 Rows(a).Interior.Color = i i = i + 10 a = a + 1 Loop End Sub I switched the i loop to go up by 10 because I wasn't getting any good variety in colors, only red black and maroon. Even after switching to intervals of 10 I'm still only getting reds yellows and greens along with blacks... I know there should be some blues and purples. Anyone have any ideas? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Jan 12, 2:02*pm, Tim Williams wrote:
Cell interior colors in XL2002 are limited to one of the 56-color palette options. If you try to use a color not in the palette it will just get mapped (not sure exactly how) to the nearest match. Tim On Jan 12, 12:38*pm, Matthew Dyer wrote: I'm trying to make a sheet that shows all the possible cell fill colors available in Excel. I'm using Excel 2002, SP3. The code I made is as follows - Sub colors() Dim i As String i = 1 a = 1 Do Until a = 65536 Rows(a).Interior.Color = i i = i + 10 a = a + 1 Loop End Sub I switched the i loop to go up by 10 because I wasn't getting any good variety in colors, only red black and maroon. Even after switching to intervals of 10 I'm still only getting reds yellows and greens along with blacks... I know there should be some blues and purples. Anyone have any ideas?- Hide quoted text - - Show quoted text - make's sense. So is there a way to code it so I can get all of the 55 possible colors to fill a cell with? (assuming 56th value is no fill at all) |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Matthew
I did not create these code, they come from the newsgroups, just don't remember from were. Sub Allcolor() Dim c As Integer Dim j As Integer For c = 0 To 5 For j = 0 To 9 If c * 10 + j < 57 Then Cells(c + 12, j + 2).Interior.ColorIndex = c * 10 + j Cells(c + 12, j + 2).Value = c * 10 + j End If Next j Next c End Sub HTH John "Matthew Dyer" wrote in message ... On Jan 12, 2:02 pm, Tim Williams wrote: Cell interior colors in XL2002 are limited to one of the 56-color palette options. If you try to use a color not in the palette it will just get mapped (not sure exactly how) to the nearest match. Tim On Jan 12, 12:38 pm, Matthew Dyer wrote: I'm trying to make a sheet that shows all the possible cell fill colors available in Excel. I'm using Excel 2002, SP3. The code I made is as follows - Sub colors() Dim i As String i = 1 a = 1 Do Until a = 65536 Rows(a).Interior.Color = i i = i + 10 a = a + 1 Loop End Sub I switched the i loop to go up by 10 because I wasn't getting any good variety in colors, only red black and maroon. Even after switching to intervals of 10 I'm still only getting reds yellows and greens along with blacks... I know there should be some blues and purples. Anyone have any ideas?- Hide quoted text - - Show quoted text - make's sense. So is there a way to code it so I can get all of the 55 possible colors to fill a cell with? (assuming 56th value is no fill at all) |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would just fill the cells in a column from 1 to 56... that way the row
number would be the ColorIndex number... Sub AllColors() Dim X As Long For X = 1 To 56 Cells(X, "A").Interior.ColorIndex = X Next End Sub To the OP.... assign the predefined color index constant xlNone for the "no color" option. -- Rick (MVP - Excel) "John" wrote in message ... Hi Matthew I did not create these code, they come from the newsgroups, just don't remember from were. Sub Allcolor() Dim c As Integer Dim j As Integer For c = 0 To 5 For j = 0 To 9 If c * 10 + j < 57 Then Cells(c + 12, j + 2).Interior.ColorIndex = c * 10 + j Cells(c + 12, j + 2).Value = c * 10 + j End If Next j Next c End Sub HTH John "Matthew Dyer" wrote in message ... On Jan 12, 2:02 pm, Tim Williams wrote: Cell interior colors in XL2002 are limited to one of the 56-color palette options. If you try to use a color not in the palette it will just get mapped (not sure exactly how) to the nearest match. Tim On Jan 12, 12:38 pm, Matthew Dyer wrote: I'm trying to make a sheet that shows all the possible cell fill colors available in Excel. I'm using Excel 2002, SP3. The code I made is as follows - Sub colors() Dim i As String i = 1 a = 1 Do Until a = 65536 Rows(a).Interior.Color = i i = i + 10 a = a + 1 Loop End Sub I switched the i loop to go up by 10 because I wasn't getting any good variety in colors, only red black and maroon. Even after switching to intervals of 10 I'm still only getting reds yellows and greens along with blacks... I know there should be some blues and purples. Anyone have any ideas?- Hide quoted text - - Show quoted text - make's sense. So is there a way to code it so I can get all of the 55 possible colors to fill a cell with? (assuming 56th value is no fill at all) |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
here's what i use, because it gives me hex values, too.
Sub Colors() Dim ctr As Long For ctr = 1 To 56 Cells(ctr, 1).Interior.ColorIndex = ctr Cells(ctr, 2).Value = "'" & Right("000000" & _ Hex(ThisWorkbook.Colors(ctr)), 6) Cells(ctr, 3).Value = ctr Cells(ctr, 4).Value = Cells(ctr, 1).Interior.Color Cells(ctr, 2).Font.Name = "Arial" Cells(ctr, 2).HorizontalAlignment = xlRight Cells(ctr, 3).HorizontalAlignment = xlCenter Cells(ctr, 4).HorizontalAlignment = xlLeft Next ctr End Sub -- Gary Keramidas Excel 2003 "Matthew Dyer" wrote in message ... On Jan 12, 2:02 pm, Tim Williams wrote: Cell interior colors in XL2002 are limited to one of the 56-color palette options. If you try to use a color not in the palette it will just get mapped (not sure exactly how) to the nearest match. Tim On Jan 12, 12:38 pm, Matthew Dyer wrote: I'm trying to make a sheet that shows all the possible cell fill colors available in Excel. I'm using Excel 2002, SP3. The code I made is as follows - Sub colors() Dim i As String i = 1 a = 1 Do Until a = 65536 Rows(a).Interior.Color = i i = i + 10 a = a + 1 Loop End Sub I switched the i loop to go up by 10 because I wasn't getting any good variety in colors, only red black and maroon. Even after switching to intervals of 10 I'm still only getting reds yellows and greens along with blacks... I know there should be some blues and purples. Anyone have any ideas?- Hide quoted text - - Show quoted text - make's sense. So is there a way to code it so I can get all of the 55 possible colors to fill a cell with? (assuming 56th value is no fill at all) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I fill one cell color with text html/rgb color from another | Excel Discussion (Misc queries) | |||
Match TextBox Back Color to Cell Fill Color | Excel Programming | |||
Cell Fill Color and text color - changes for recipient | Excel Discussion (Misc queries) | |||
change fill color of a range of cells based on color of a cell? | Excel Programming | |||
Set Cell Fill Color | Excel Programming |