ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can I create a Custom Colour? (https://www.excelbanter.com/excel-programming/356287-can-i-create-custom-colour.html)

Co-op Bank

Can I create a Custom Colour?
 
Hello, I need to colour a cell using VBA but the standard color index
property only gives me 1 shade of yellow to choose from, is there anyway I
can use a spare color index property and make that the color I need somehow?
or any other way?

Thanks
Brian
Manchester, England

Thunder[_2_]

Can I create a Custom Colour?
 

"Co-op Bank" ha scritto nel messaggio
...
Hello, I need to colour a cell using VBA but the standard color index
property only gives me 1 shade of yellow to choose from, is there anyway I
can use a spare color index property and make that the color I need
somehow?
or any other way?

Thanks
Brian
Manchester, England


If using RGB color?
For example: ActiveCell.Interior.Color = RGB(0, 0, 255)

Thunder



Chip Pearson

Can I create a Custom Colour?
 
If using RGB color?
For example: ActiveCell.Interior.Color = RGB(0, 0, 255)


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.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Thunder" wrote in message
...

"Co-op Bank" ha scritto
nel messaggio
...
Hello, I need to colour a cell using VBA but the standard
color index
property only gives me 1 shade of yellow to choose from, is
there anyway I
can use a spare color index property and make that the color I
need somehow?
or any other way?

Thanks
Brian
Manchester, England


If using RGB color?
For example: ActiveCell.Interior.Color = RGB(0, 0, 255)

Thunder




Peter T

Can I create a Custom Colour?
 
Hi Brian,

You can customise any of your 56 palette colours

manually - Tools / Options / Color

vba -
ActiveWorkbook.Colors(40) = RGB(255, 255, 220) 'very pale yellow

The customised palette is saved with the Workbook.

With respect to the adjacent suggestion, applying an RGB color to format a
cell results in Excel finding the nearest matching colour in the existing
palette, then applying that colorindex.

Regards,
Peter T


"Co-op Bank" wrote in message
...
Hello, I need to colour a cell using VBA but the standard color index
property only gives me 1 shade of yellow to choose from, is there anyway I
can use a spare color index property and make that the color I need

somehow?
or any other way?

Thanks
Brian
Manchester, England





All times are GMT +1. The time now is 12:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com