ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Customizing colors (https://www.excelbanter.com/excel-programming/361634-customizing-colors.html)

pmguerra[_7_]

Customizing colors
 

Hi!

I've used the following code to change the cell color.

Sub dfghrth()

ActiveCell.Interior.Color = RGB(221, 255, 221)

End Sub



But instead of actually changing to the color I've defined, it changes
to a pallette default color...

Help anyone?


--
pmguerra
------------------------------------------------------------------------
pmguerra's Profile: http://www.excelforum.com/member.php...o&userid=14986
View this thread: http://www.excelforum.com/showthread...hreadid=542600


Tom Ogilvy

Customizing colors
 
A worksheet can only display 56 predefined colors (the palette).

You will need to redefine the palette to provide the colors you need or you
will get the behavior you describe.

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

A posible workaround is to use a shape/autoshape instead of a cell as these
can display more simultaneous colors.

--
Regards,
Tom Ogilvy



"pmguerra" wrote:


Hi!

I've used the following code to change the cell color.

Sub dfghrth()

ActiveCell.Interior.Color = RGB(221, 255, 221)

End Sub



But instead of actually changing to the color I've defined, it changes
to a pallette default color...

Help anyone?


--
pmguerra
------------------------------------------------------------------------
pmguerra's Profile: http://www.excelforum.com/member.php...o&userid=14986
View this thread: http://www.excelforum.com/showthread...hreadid=542600



Harald Staff

Customizing colors
 
You have to change the pallette, Excel has no more than 56 colors to work
with:

If ActiveCell.Interior.ColorIndex 2 Then _
ActiveWorkbook.Colors(ActiveCell.Interior.ColorInd ex) = _
RGB(221, 255, 221)

HTH. Best wishes Harald

"pmguerra" skrev i
melding ...

Hi!

I've used the following code to change the cell color.

Sub dfghrth()

ActiveCell.Interior.Color = RGB(221, 255, 221)

End Sub



But instead of actually changing to the color I've defined, it changes
to a pallette default color...

Help anyone?


--
pmguerra
------------------------------------------------------------------------
pmguerra's Profile:

http://www.excelforum.com/member.php...o&userid=14986
View this thread: http://www.excelforum.com/showthread...hreadid=542600





All times are GMT +1. The time now is 07:29 PM.

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