Identifying the name of the fill color of a range
I didn't see Bob's when I posted - you could add the extra "#" colours to
Bob's list of constants. Bear in mind, as Bob indicated, colorindex's might
not relate to named colours in a default palette.
Return a list of long colour values
For i = 1 To 56
Cells(i, 1) = ThisWorkbook.Colors(i)
Next
Put names in Col B
Sort the colour values
Get rid of duplicates
Now you have a lookup table !
Regards,
Peter T
"Peter T" <peter_t@discussions wrote in message
...
Hi Pete,
The "default" chart colours are also named though 10 of these are
duplicates
of other colours in a default palette.
17 # Periwinkle
18 Plum
19 # Ivory
20 # Light Turquoise
21 Dark Purple
22 # Coral
23 # Ocean Blue
24 # Ice Blue
25 Dark Blue
26 Pink
27 Yellow
28 Turquoise
29 Violet
30 Dark Red
31 Teal
32 Blue
# denotes non-duplicated colour.
There's no direct way to return these names, I do it by comparing the long
colour value in a lookup table of values & names.
Regards,
Peter T
"Peter Rooney" wrote in message
...
Good morning, all!
Is there any way in VBA to trap the name of the interior.colorindex
values,
so, for any selection, I can msgbox the name of the fillcolor e.g. Red,
Blue,
Rose, Tan etc?
The reason for this is that colors 17 to 32 can also be used, but
they're
not on the toolbar palette, and I want to know if Excel has names for
them.
Yes, I KNOW I need to get out more! :-)
Thanks in advance!
Pete
|