Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rich - 20 Mar 2006 20:43 GMT
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
Jim Thomlinson - 20 Mar 2006 21:11 GMT
Take a look at this...

http://www.cpearson.com/excel/colors.htm#RGB
Signature

HTH...

Jim Thomlinson

> Hello,
>
[quoted text clipped - 7 lines]
> Thanks,
> Rich
Jim Thomlinson - 20 Mar 2006 21:11 GMT
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.

Signature

HTH...

Jim Thomlinson

> Hello,
>
[quoted text clipped - 7 lines]
> Thanks,
> Rich
Rich - 20 Mar 2006 22:11 GMT
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.

> Additionally here is a recent post from Chip...
>
[quoted text clipped - 22 lines]
> > Thanks,
> > Rich
Peter T - 20 Mar 2006 22:35 GMT
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

> 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?
[quoted text clipped - 39 lines]
> > > Thanks,
> > > Rich
Peter T - 20 Mar 2006 22:54 GMT
PS, forgot I posted a macro to display the 216 "web-safe" colours in a
worksheet here

http://tinyurl.com/fay37

Other colours in the old 256 palette are greys and system colours.

Regards,
Peter T

> If you want a grey just make all the RGB colours the same.
>
[quoted text clipped - 68 lines]
> > > > Thanks,
> > > > Rich
Jim Thomlinson - 20 Mar 2006 22:41 GMT
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.
Signature

HTH...

Jim Thomlinson

> 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?  
[quoted text clipped - 34 lines]
> > > Thanks,
> > > Rich
Rich - 20 Mar 2006 23:13 GMT
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.

> 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?  
[quoted text clipped - 34 lines]
> > > Thanks,
> > > Rich
Vic Eldridge - 21 Mar 2006 05:40 GMT
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

> Thank you all for your replies.  Now I get it  - only 56 color in the color
> palette.  I added
[quoted text clipped - 41 lines]
> > > > Thanks,
> > > > Rich
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.