Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
??? 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
Posted to microsoft.public.excel.programming
|
|||
|
|||
??? 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
Posted to microsoft.public.excel.programming
|
|||
|
|||
??? 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
Posted to microsoft.public.excel.programming
|
|||
|
|||
??? 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
Posted to microsoft.public.excel.programming
|
|||
|
|||
??? 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
Posted to microsoft.public.excel.programming
|
|||
|
|||
??? 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
Posted to microsoft.public.excel.programming
|
|||
|
|||
??? 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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to get a dump of Fill Color & Font VBA Constants? | Excel Discussion (Misc queries) | |||
Where can I find a full list of "mso" constants? | Excel Programming | |||
Is there a list of constants and conditions available anywhere? | Excel Programming | |||
Color constants in VBA | Excel Programming | |||
List of VBA Functions and Constants | Excel Programming |