![]() |
coloring limits
Can we color the Excel sheet cells with any desired color through VBA (using
RGB function for example) or we are restricted with the color set that we can use from the worksheet? |
coloring limits
Marwan,
Excel has a color pallet of 56 colors -- everything in Excel (Fonts, Backgrounds, Charts, etc) must be one of those 56 colors. However, you can put any of the 16 million RGB colors in to the pallet. You can define your own color pallet using code like ThisWorkbook.Colors(56) = RGB(123, 45, 67) This defines color 56 to be the color value produced by RGB(123, 45, 67). You can assign any or all of the 1 to 56 Color array elements to whatever colors you desire. When you change a color value in the Colors array, all elements (text, backgrounds, etc) that use that ColorIndex will use the new color value. For example, if you use code like Range("A1").Interior.ColorIndex = 42 you are using Colors(42). If you then change Colors(42) to another color with code like ThisWorkbook.Colors(56) = RGB(123, 45, 67) then A1 will have the new color. So in summary, yes, you are limited to 56 colors, but each of those colors can be any of 16 million available colors. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "marwan hefnawy" wrote in message ... Can we color the Excel sheet cells with any desired color through VBA (using RGB function for example) or we are restricted with the color set that we can use from the worksheet? |
All times are GMT +1. The time now is 05:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com