Working with colors (default and custom)

K

ker_01

XL2003 on XP

I'm color coding a range of cells in my worksheet, which I'm then exporting
(in chunks) as EMF files to be uploaded into Visio and paired with specific
shapes as status indicators.

I'm using most of the built-in colors (vb blue, cyan, green, magenta, red,
yellow) but that wasn't enough distinctly colors to cover my target
categories, so I added a few more:

My_vbOrange = RGB(255, 128, 0)
My_vbDarkGreen = RGB(0, 128, 0)
My_vbDrkPurple = RGB(255, 0, 255)
My_vbLtPurple = RGB(90, 90, 255)
My_vbPuke = RGB(128, 128, 0)
My_vbOcean = RGB(64, 128, 128)
My_vbRose = RGB(180, 60, 95)
My_vbBrown = RGB(255, 128, 0)

I then use a select case statement for each value to determine which color
to use as the cell fill.

When I run my code, most of the colors appear to work as expected (orange,
rose, ocean all show up). However, I just noticed that my two purples are not
differentiating on the worksheet- they are both exactly the same color of
pink (same as pink on the color picklist).

My goal was to use colors that were more differentiated than the built in
set, but without actually changing the pallet (in case anyone else uses this
workbook, I don't want to cause other unforeseen problems with them changing
workbook colors and affecting my pallet).

Am I stuck just using the default colorindex pallet set? Also, why are some
of my colors working and not others?

Thanks,
Keith
 
J

JLGWhiz

This is a pretty comprehensive site for color breakout.

http://www.mvps.org/dmcritchie/excel/colors.htm

However, using colors for flags can be more trouble than it is worth. It
might be better to use a helper column or row. i.e. a column or row outside
the normal block of cells used for the database. You can then use an
unlimited combination of characters to identify the columns or rows within
the database area that need some action taken. Then you do not have to be
concerned about another user's system capabilities.
 
P

Patrick Molloy

it sounds like you're re-inventing the wheel

this code creates a named range called colorlist with all the available
colors:

Sub CreateColorList()
Dim i As Long
For i = 0 To 56
Cells(i + 1, 1) = i
Cells(i + 1, 2).Interior.ColorIndex = i
Next
Range("A1:B57").Name = "colorlist"
End Sub


to color a cell just use this as a handy guide
 
K

ker_01

Wow, what a great site! Thank you for the link.

I've got what I think you mean by the helper section already; the end result
of coloring these cells is that I export cell ranges as a graphics file,
which is then imported into Visio- so the desired end result is the colors
themselves. I'm trying to select colors that are all visually distinct from
each other (light blue, and light blue-grey might look too close on the final
visio sheet, and I don't want to cause any confusion). If I understand
correctly, then it looks like I'm still limited to the regular palette
(because I don't want to have to deal with moving custom palettes between
machines, if anyone else needs to use this). I looked at the default palette
and found almost enough very distinctly different colors, but not quite
enough... but I guess I'll just have to live with what is available.

Thanks!
Keith
 
K

ker_01

Thanks Patrick!

Since it looks like I'm limited to the colorlist, I'll use your suggestion
to figure out which default colors are which. I was trying to create/pick
colors that aren't on the default list to ensure that the colors used were as
different as possible, but apparently Excel defaults to the nearest colorlist
option- and I want to avoid changing the actual default colorlist.

Best,
Keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top