how to get lighter shade of gray for interior color of a cell?

G

Guest

Hello,

I recorded a macro for setting the interior color of a cell to the lightest
gray in the color palet on the toolbar. But I need a lighter shade of gray.
I experimented with various color indexes, but these indexes seem to only use
the colors from the color palet on the toolbar. Is there a way to use the
RGB color function maybe, to color the interior of a cell to a shade that is
not on the color palet on the toolbar? How is this done?

Thanks,
Rich
 
G

Guest

Additionally here is a recent post from Chip...

Note that Excel supports only 56 colors, although you can specify
which 56 colors are used. If you attempt to use a color that is
not in Excel's palette of colors, Excel will use the closest
match. To use a specific color with RGB, you should set one of
the colors in the palette to that color, then use ColorIndex to
get the color to the cell. E.g,

ThisWorkbook.Colors(56) = RGB(r,g,b)
ActiveCell.Interior.ColorIndex = 56

See www.cpearson.com/excel/colors.htm for more info about working
with colors.
 
G

Guest

Thank you very much for your reply. One more question if I may - is there a
way to determine what color you get with RGB ? like what numbers to select?
I have always had a problem with that using RGB. Is there maybe website that
lists that various color you can get with RBG?

Also, I did notice that the lightest color of gray that I was able to get
using RGB (but not adding to the palette yet) was the same shade that is
currently in the palette. So if I find an RGB number that is lighter, and I
add that to the palette in my respective workbook, then I can use that color?

Thanks again.
 
P

Peter T

If you want a grey just make all the RGB colours the same.

FYI, the lightest gray in a default palette is applied to colorindex 15 as
RGB(192,192,192)

You might try, say

Activeworkbook.colors(54) = rgb(204,204,204)
Activeworkbook.colors(39) = rgb(229,229,229)

Each RGB attribute should be in the range 0-255

As there are 256 x 256 x 256 = 16 million permutations, no web site will
show you all possible RGB colours. Though plenty of sites display the so
called "web safe" colours that exist in the old 256 colour palette.

Regards,
Peter T
 
G

Guest

As for the colors generated by RGB the number is astronomical (16 Million
256*256*256) so you may not have a lot of luck finding a website that shows
all of the colours...

As I understand it once you add the color to the pallet you can feel free to
use it. The only caveat is that you can only have 56 colors in total.
 
G

Guest

Thank you all for your replies. Now I get it - only 56 color in the color
palette. I added

ActiveWorkbook.Colors(39) = RGB(229, 229, 229)

that is the shade of gray that I needed.
 
G

Guest

Another piece of information that may be of interest to you is that the next
version of Excel (due out this year sometime) will support support 4.3
billion individual colours. I guess then we'll be able to set the Color
property to RGB(x,x,x) without the colour reverting back to a colorindex
value.

Regards,
Vic Eldridge
 

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