Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default ??? How to get list of Color constants

I have the following code with colorindx number 1 representing black color,

May I know how do I get the related color constatn list (ie what number =
what color) in VBA

With Selection.Interior
.ColorIndex = 1
End With

--
Thanks a million for your time and expert advice :-)
Jaylin
*****Jaylin Message ended*******
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 182
Default ??? How to get list of Color constants

Hi,
Not sure but try this one
Sub Colorindexinterior()
For r = 0 To 56 'max is 56 as I know
Cells(r + 1, 1).Interior.ColorIndex = r
Cells(r + 1, 1).Offset(0, 1) = Cells(r + 1, 1).Interior.ColorIndex
Next
End Sub

I don't know if colorindex conts is available
--

Regards,

Halim


"Jaylin" wrote:

I have the following code with colorindx number 1 representing black color,

May I know how do I get the related color constatn list (ie what number =
what color) in VBA

With Selection.Interior
.ColorIndex = 1
End With

--
Thanks a million for your time and expert advice :-)
Jaylin
*****Jaylin Message ended*******

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default ??? How to get list of Color constants

Here is an enumerated list which you can add to a module and then use the
colour constant name.

Public Enum xlColorIndex
xlCIBlack = 1
xlCIWhite = 2
xlCIRed = 3
xlCIBrightGreen = 4
xlCIBlue = 5
xlCIYellow = 6
xlCIPink = 7
xlCITurquoise = 8
xlCIDarkRed = 9
xlCIGreen = 10
xlCIDarkBlue = 11
xlCIDarkYellow = 12
xlCIViolet = 13
xlCITeal = 14
xlCIGray25 = 15
xlCIGray50 = 16
xlCIPeriwinkle = 17
xlCIPlum = 18
xlCIIvory = 19
xlCILightTurquoise = 20
xlCIDarkPurple = 21
xlCICoral = 22
xlCIOceanBlue = 23
xlCIIceBlue = 24
'xlCIDarkBlue = 25
'xlCIPink = 26
'xlCIYellow = 27
'xlCITurquoise = 28
'xlCIViolet = 29
'xlCIDarkRed = 30
'xlCITeal = 31
'xlCIBlue = 32
xlCISkyBlue = 33
xlCILightGreen = 35
xlCILightYellow = 36
xlCIPaleBlue = 37
xlCIRose = 38
xlCILavender = 39
xlCITan = 40
xlCILightBlue = 41
xlCIAqua = 42
xlCILime = 43
xlCIGold = 44
xlCILightOrange = 45
xlCIOrange = 46
xlCIBlueGray = 47
xlCIGray40 = 48
xlCIDarkTeal = 49
xlCISeaGreen = 50
xlCIDarkGreen = 51
xlCIBrown = 53
xlCIIndigo = 55
xlCIGray80 = 56
End Enum



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Jaylin" wrote in message
...
I have the following code with colorindx number 1 representing black

color,

May I know how do I get the related color constatn list (ie what number =
what color) in VBA

With Selection.Interior
.ColorIndex = 1
End With

--
Thanks a million for your time and expert advice :-)
Jaylin
*****Jaylin Message ended*******



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default ??? How to get list of Color constants

Bob,
Wasn't quite sure about use of enums, but I pasted the below into a
standard module; then only in the immediate window I entered:

Range("B4").Interior.ColorIndex = xlCIYellow

And it worked (suddenly my cell B4 turned yellow) Yikes,,,

My question is: If someone worked with and needed/wanted to
Use the this scheme index they would simply INCLUDE the 58 lines
As is into a standard module of either the: 1)Activeworkbook,
2)Personal.xls
Or 3)an add-in?

Thanks for your help,,
Jim May


"Bob Phillips" wrote in message
:

Here is an enumerated list which you can add to a module and then use the
colour constant name.

Public Enum xlColorIndex
xlCIBlack = 1
xlCIWhite = 2
xlCIRed = 3
xlCIBrightGreen = 4
xlCIBlue = 5
xlCIYellow = 6
xlCIPink = 7
xlCITurquoise = 8
xlCIDarkRed = 9
xlCIGreen = 10
xlCIDarkBlue = 11
xlCIDarkYellow = 12
xlCIViolet = 13
xlCITeal = 14
xlCIGray25 = 15
xlCIGray50 = 16
xlCIPeriwinkle = 17
xlCIPlum = 18
xlCIIvory = 19
xlCILightTurquoise = 20
xlCIDarkPurple = 21
xlCICoral = 22
xlCIOceanBlue = 23
xlCIIceBlue = 24
'xlCIDarkBlue = 25
'xlCIPink = 26
'xlCIYellow = 27
'xlCITurquoise = 28
'xlCIViolet = 29
'xlCIDarkRed = 30
'xlCITeal = 31
'xlCIBlue = 32
xlCISkyBlue = 33
xlCILightGreen = 35
xlCILightYellow = 36
xlCIPaleBlue = 37
xlCIRose = 38
xlCILavender = 39
xlCITan = 40
xlCILightBlue = 41
xlCIAqua = 42
xlCILime = 43
xlCIGold = 44
xlCILightOrange = 45
xlCIOrange = 46
xlCIBlueGray = 47
xlCIGray40 = 48
xlCIDarkTeal = 49
xlCISeaGreen = 50
xlCIDarkGreen = 51
xlCIBrown = 53
xlCIIndigo = 55
xlCIGray80 = 56
End Enum



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Jaylin" wrote in message
...

I have the following code with colorindx number 1 representing black


color,


May I know how do I get the related color constatn list (ie what number =
what color) in VBA

With Selection.Interior
.ColorIndex = 1
End With

--
Thanks a million for your time and expert advice :-)
Jaylin
*****Jaylin Message ended*******


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default ??? How to get list of Color constants

Hi Jim,

In the workbook that the code that uses it is also in.

It gets better.

Create a simple sub like so


Sub SetColour(cell As Range, colour As xlColorIndex)
cell.Interior.ColorIndex = colour
End Sub

then in the immediate window, type

SetColour Activecell,

when you type the colour, you will see a list pop, intellisense just as with
other parts of VBA :-). This will also happen when entering code normally.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Jim May" wrote in message
news:ibSNg.14642$xk3.1671@dukeread07...
Bob,
Wasn't quite sure about use of enums, but I pasted the below into a
standard module; then only in the immediate window I entered:

Range("B4").Interior.ColorIndex = xlCIYellow

And it worked (suddenly my cell B4 turned yellow) Yikes,,,

My question is: If someone worked with and needed/wanted to
Use the this scheme index they would simply INCLUDE the 58 lines
As is into a standard module of either the: 1)Activeworkbook,
2)Personal.xls
Or 3)an add-in?

Thanks for your help,,
Jim May


"Bob Phillips" wrote in message
:

Here is an enumerated list which you can add to a module and then use

the
colour constant name.

Public Enum xlColorIndex
xlCIBlack = 1
xlCIWhite = 2
xlCIRed = 3
xlCIBrightGreen = 4
xlCIBlue = 5
xlCIYellow = 6
xlCIPink = 7
xlCITurquoise = 8
xlCIDarkRed = 9
xlCIGreen = 10
xlCIDarkBlue = 11
xlCIDarkYellow = 12
xlCIViolet = 13
xlCITeal = 14
xlCIGray25 = 15
xlCIGray50 = 16
xlCIPeriwinkle = 17
xlCIPlum = 18
xlCIIvory = 19
xlCILightTurquoise = 20
xlCIDarkPurple = 21
xlCICoral = 22
xlCIOceanBlue = 23
xlCIIceBlue = 24
'xlCIDarkBlue = 25
'xlCIPink = 26
'xlCIYellow = 27
'xlCITurquoise = 28
'xlCIViolet = 29
'xlCIDarkRed = 30
'xlCITeal = 31
'xlCIBlue = 32
xlCISkyBlue = 33
xlCILightGreen = 35
xlCILightYellow = 36
xlCIPaleBlue = 37
xlCIRose = 38
xlCILavender = 39
xlCITan = 40
xlCILightBlue = 41
xlCIAqua = 42
xlCILime = 43
xlCIGold = 44
xlCILightOrange = 45
xlCIOrange = 46
xlCIBlueGray = 47
xlCIGray40 = 48
xlCIDarkTeal = 49
xlCISeaGreen = 50
xlCIDarkGreen = 51
xlCIBrown = 53
xlCIIndigo = 55
xlCIGray80 = 56
End Enum



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Jaylin" wrote in message
...

I have the following code with colorindx number 1 representing black


color,


May I know how do I get the related color constatn list (ie what

number =
what color) in VBA

With Selection.Interior
.ColorIndex = 1
End With

--
Thanks a million for your time and expert advice :-)
Jaylin
*****Jaylin Message ended*******






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 477
Default ??? How to get list of Color constants

Bob,
Thanks .. much appreciated - have printed-off
your comments to study and commit to memory later.
Jim

"Bob Phillips" wrote:

Hi Jim,

In the workbook that the code that uses it is also in.

It gets better.

Create a simple sub like so


Sub SetColour(cell As Range, colour As xlColorIndex)
cell.Interior.ColorIndex = colour
End Sub

then in the immediate window, type

SetColour Activecell,

when you type the colour, you will see a list pop, intellisense just as with
other parts of VBA :-). This will also happen when entering code normally.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Jim May" wrote in message
news:ibSNg.14642$xk3.1671@dukeread07...
Bob,
Wasn't quite sure about use of enums, but I pasted the below into a
standard module; then only in the immediate window I entered:

Range("B4").Interior.ColorIndex = xlCIYellow

And it worked (suddenly my cell B4 turned yellow) Yikes,,,

My question is: If someone worked with and needed/wanted to
Use the this scheme index they would simply INCLUDE the 58 lines
As is into a standard module of either the: 1)Activeworkbook,
2)Personal.xls
Or 3)an add-in?

Thanks for your help,,
Jim May


"Bob Phillips" wrote in message
:

Here is an enumerated list which you can add to a module and then use

the
colour constant name.

Public Enum xlColorIndex
xlCIBlack = 1
xlCIWhite = 2
xlCIRed = 3
xlCIBrightGreen = 4
xlCIBlue = 5
xlCIYellow = 6
xlCIPink = 7
xlCITurquoise = 8
xlCIDarkRed = 9
xlCIGreen = 10
xlCIDarkBlue = 11
xlCIDarkYellow = 12
xlCIViolet = 13
xlCITeal = 14
xlCIGray25 = 15
xlCIGray50 = 16
xlCIPeriwinkle = 17
xlCIPlum = 18
xlCIIvory = 19
xlCILightTurquoise = 20
xlCIDarkPurple = 21
xlCICoral = 22
xlCIOceanBlue = 23
xlCIIceBlue = 24
'xlCIDarkBlue = 25
'xlCIPink = 26
'xlCIYellow = 27
'xlCITurquoise = 28
'xlCIViolet = 29
'xlCIDarkRed = 30
'xlCITeal = 31
'xlCIBlue = 32
xlCISkyBlue = 33
xlCILightGreen = 35
xlCILightYellow = 36
xlCIPaleBlue = 37
xlCIRose = 38
xlCILavender = 39
xlCITan = 40
xlCILightBlue = 41
xlCIAqua = 42
xlCILime = 43
xlCIGold = 44
xlCILightOrange = 45
xlCIOrange = 46
xlCIBlueGray = 47
xlCIGray40 = 48
xlCIDarkTeal = 49
xlCISeaGreen = 50
xlCIDarkGreen = 51
xlCIBrown = 53
xlCIIndigo = 55
xlCIGray80 = 56
End Enum



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Jaylin" wrote in message
...

I have the following code with colorindx number 1 representing black

color,


May I know how do I get the related color constatn list (ie what

number =
what color) in VBA

With Selection.Interior
.ColorIndex = 1
End With

--
Thanks a million for your time and expert advice :-)
Jaylin
*****Jaylin Message ended*******





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default ??? How to get list of Color constants

If you want to see a color chart, open the Visual Basic Editor and click
Help. Type in the search box "PatternColorIndex Property" without the quote
marks and then click on the same words when they show in the options panel.
This will display the chart with the numbers for the colors. If you print
the chart you will notice that your printer limits the amount of variation to
the colors based on the printer capabilities so that when printed, index
numbers 18, 29 and 54 might look the same when printed.

"Jaylin" wrote:

I have the following code with colorindx number 1 representing black color,

May I know how do I get the related color constatn list (ie what number =
what color) in VBA

With Selection.Interior
.ColorIndex = 1
End With

--
Thanks a million for your time and expert advice :-)
Jaylin
*****Jaylin Message ended*******

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get a dump of Fill Color & Font VBA Constants? EagleOne Excel Discussion (Misc queries) 3 August 17th 06 08:17 PM
Where can I find a full list of "mso" constants? Nick Hebb Excel Programming 10 November 13th 05 09:44 PM
Is there a list of constants and conditions available anywhere? fuzzy Excel Programming 2 August 24th 05 02:55 PM
Color constants in VBA Mark Tangard[_3_] Excel Programming 10 July 22nd 04 11:03 PM
List of VBA Functions and Constants SuperJas Excel Programming 4 June 10th 04 03:58 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"