Color constants in VBA
keepITcool wrote:
Mark Tangard wrote in :
Hm. Actually it still doesn't come up in my VBA Help (XL 2000)....
These do work; but I was hoping to find the constants for all 40 of
the colors that can be applied to a cell interior from the toolbar
dropdown. Are these not all available as VBA constants?
Dont get confused between VBA color constants
and EXCEL COLORINDEX and COLORS properties
When you speak of 40 colors you're referring to the COLORINDEX
each workbook has a property called COLORS.
this is in fact an 1x56 array of doubles representing RGB values.
the colorindex is a pointer to an element in the COLORS array.
note hex representation is BRG not RGB..
activecell.Interior.Color=&Hff0000 '<= BLUE 255,Green0,Red0
?activecell.Interior.ColorIndex
5
dim ci,co
co=activeworkbook.colors
for each ci in co
debug.print ci, hex(ci)
next
hth
OK, thanks, that clarifies. It's a shame they're not available in
text-mnemonic constants, as in Word. Guess I'll be doing a lot of
memorizing....
MT
|