ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   What are the values for ColorIndex 's 56 colors ? i.e. green=3 . (https://www.excelbanter.com/excel-programming/327208-what-values-colorindex-s-56-colors-i-e-green%3D3.html)

RandyDtg1[_2_]

What are the values for ColorIndex 's 56 colors ? i.e. green=3 .
 
What are the values for ColorIndex 's 56 colors ? i.e. green=3 ... Or
where can a table of the values be found ?



Patrick Molloy[_2_]

What are the values for ColorIndex 's 56 colors ? i.e. green=3 .
 
Option Explicit

Sub ShowColors()
Dim i As Long
For i = 0 To 56
Cells(i + 1, 1) = i
Cells(1 + i, 3).Interior.ColorIndex = i
Cells(1 + i, 2) = Cells(1 + i, 3).Interior.Color
Next
End Sub

"RandyDtg1" wrote:

What are the values for ColorIndex 's 56 colors ? i.e. green=3 ... Or
where can a table of the values be found ?



K Dales[_2_]

What are the values for ColorIndex 's 56 colors ? i.e. green=3 .
 
Excel Help file, Programming Information, Microsoft Excel Visual Basic
Reference, Properties... ColorIndex Property. GIves a table showing values
& corresponding colors.

"RandyDtg1" wrote:

What are the values for ColorIndex 's 56 colors ? i.e. green=3 ... Or
where can a table of the values be found ?



Patrick Molloy[_2_]

What are the values for ColorIndex 's 56 colors ? i.e. green
 
once you decided on your colors, use an ENU< varaible to set them. It makes
code so much easier to read
example: a small sub to color thre eranges
Sub tester()
Range("B2:C2").Interior.Color = 255
Range("B2:C2").Interior.Color = 16711680
Range("B2:C2").Interior.Color = 65280
End Sub

looks clearer this way:-

Option Explicit
Enum eColor
Red = 255
Blue = 16711680
Green = 65280
End Enum
Sub tester()
Range("B2:C2").Interior.Color = eColor.Red
Range("B2:C2").Interior.Color = eColor.Blue
Range("B2:C2").Interior.Color = eColor.Green
End Sub

Patrick

"Patrick Molloy" wrote:

Option Explicit

Sub ShowColors()
Dim i As Long
For i = 0 To 56
Cells(i + 1, 1) = i
Cells(1 + i, 3).Interior.ColorIndex = i
Cells(1 + i, 2) = Cells(1 + i, 3).Interior.Color
Next
End Sub

"RandyDtg1" wrote:

What are the values for ColorIndex 's 56 colors ? i.e. green=3 ... Or
where can a table of the values be found ?



david mcritchie

What are the values for ColorIndex 's 56 colors ? i.e. green=3 .
 
Hi Randy,
Color Palette and the 56 Excel ColorIndex Colors
http://www.mvps.org/dmcritchie/excel/colors.htm

If you want to know where it is in your Excel Help, it isn't, it is in your VBE Help
colorindex property
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"RandyDtg1" wrote ..
What are the values for ColorIndex 's 56 colors ? i.e. green=3 ... Or
where can a table of the values be found ?





keepITcool

What are the values for ColorIndex 's 56 colors ? i.e. green=3 .
 

David McCritchie has a lot of code on his site.

however, i find it a bit confusing to use names.
to me it's simple : i KNOW the position on the ColorFill palet.
so i have a little function mapping palette location to colorindex.

Sub DemoUse()
'Green
ActiveCell(1, 1).Interior.ColorIndex = ColorMap(4, 4)
'Orange
ActiveCell(2, 1).Interior.ColorIndex = ColorMap(2, 2)
End Sub

Function ColorMap&(PaletteRow&, PaletteCol&)
Dim PaletteIndex&
Static aIdx
If IsEmpty(aIdx) Then
aIdx = Array(1, 53, 52, 51, 49, 11, 55, 56, 9, 46, 12, _
10, 14, 5, 47, 16, 3, 45, 43, 50, 42, 41, 13, 48, 7, 44, _
6, 4, 8, 33, 54, 15, 38, 40, 36, 35, 34, 37, 39, 2, 17, _
18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, _
32)
If LBound(aIdx) = 0 Then
ReDim Preserve aIdx(1 To UBound(aIdx) + 1)
End If
End If
PaletteIndex = (PaletteRow - 1) * 8 + PaletteCol

If PaletteIndex = 1 And PaletteIndex <= 56 Then
ColorMap = aIdx(PaletteIndex)
Else
ColorMap = xlNone
End If
End Function




--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


RandyDtg1 wrote :

What are the values for ColorIndex 's 56 colors ? i.e. green=3 ...
Or where can a table of the values be found ?


RandyDtg1[_2_]

Where is ColorIndex table in Excel VBA Help
 
Thanks for all the help.
I can not find any ColorIndex table in Excel VBA Help, if you can tell me
where, that would also be great.

Thanks.


Myrna Larson

What are the values for ColorIndex 's 56 colors ? i.e. green=3 .
 
Keep in mind that the user can modify the color palette; each workbook can
have its own variation.

On Mon, 11 Apr 2005 05:52:01 -0700, RandyDtg1
wrote:

What are the values for ColorIndex 's 56 colors ? i.e. green=3 ... Or
where can a table of the values be found ?



keepITcool

Where is ColorIndex table in Excel VBA Help
 

Randy:

each workbook has its own .Colors, an array of 56 rgb values
which can be modified by the user, via Tools/Options/Colors.

the colorindex property found in many excel objects points to that
array.

if you set a .COLOR property of an object to some specified RGB value:
the 'nearest' RGB value is searched in the .COLORS array and the INDEX
to that value (the COLORINDEX) is then stored with the object.
Note that your object will NOT be colored with that exact RGB value,
but by the RGB value in the workbooks.Colors() array at position
COLORINDEX.

If you want to create your 'housestyle' you must change the rgb values
in the workbook's colors array.


Since the order of the colorindexes in the default colors array is
'somewhat' haphazard (and imo has no obvious logic to it).

You'd expect that ColorIndex 5 would point to the 5th icon on the
'Palette' (the Fill Colors toolbar), but alas that is not so.

So therefor I use my ColorMap function.


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


RandyDtg1 wrote :

Thanks for all the help.
I can not find any ColorIndex table in Excel VBA Help, if you can
tell me where, that would also be great.

Thanks.


Tom Ogilvy

Where is ColorIndex table in Excel VBA Help
 
I don't think it is in xl2000 and later. It is in xl97 for sure.

--
Regards,
Tom Ogilvy

"RandyDtg1" wrote in message
...
Thanks for all the help.
I can not find any ColorIndex table in Excel VBA Help, if you can tell me
where, that would also be great.

Thanks.





All times are GMT +1. The time now is 09:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com