View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default cell fill color spectrum

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)