View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Cell Shading Colour Property

I don't think there are "official" names for all the colors, but if you
copy/paste this code line into the Immediate window and execute it (you can
also but a Sub/EndSub around it and execute it as a macro if you want), the
code will fill the first 56 rows with the 56 available color indexes... you
can look at them and decide on the names to describe them yourself.

For X = 1 To 56: Cells(X, "A").Interior.ColorIndex = X: Next

--
Rick (MVP - Excel)


"Tim Childs" wrote in message
...
Hi

The first function gives a cell's shading colour-index property and the
second converts it to a description. Has anyone the list of indexes and a
colour description so I no longer need the Else statement near the end. I
wnated to cover the basic colours in the Format cells tab, 40+ I suppose

Thanks

Tim

PS hope the US colleagues will forgive "colour" variant spelling :)

Function ShowColourIndexNo(Cell As Object) As Integer
ShowColourIndexNo = Cell.Interior.ColorIndex
End Function

Function ConvertColorIndexToText(Cell As Object) As String
Dim Temp As Variant

Select Case Cell.Value
Case -4142
Temp = "No colour"
Case 3
Temp = "Bright red"
Case 4
Temp = "Bright green"
Case 5
Temp = "Dark blue"
Case 34
Temp = "Light blue"
Case 35
Temp = "Light green"
Case Else
Temp = "Non-specified"
End Select

ConvertColorIndexToText = Temp

End Function