Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
RGB for cell interior
I want to apply an RGB color to a cell interior using VBA. TIA, James
|
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
RGB for cell interior
Sub rgbcolorinterior()
Range("j6").Interior.Color = RGB(228, 234, 244) End Sub -- Don Guillett SalesAid Software "Zone" wrote in message oups.com... I want to apply an RGB color to a cell interior using VBA. TIA, James |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
RGB for cell interior
James,
The excel color palate only allows for 50ish (55?) colors, so if you want to set a specific RGB color, you will first need to edit the palate of your excel file. ActiveWorkbook.Colors(colorindex) = RGB(red, green, blue) where red, green and blue are integers between 0 and 255 and the color index is also an integer. Then, you can apply that color to cells via (example sets the interior color of cell A1 to your defined color): range("A1").Interior.Color = ActiveWorkbook.Colors(colorindex) HTH, Abe Zone wrote: I want to apply an RGB color to a cell interior using VBA. TIA, James |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
RGB for cell interior
Don, correct me if I am wrong, but doesn't that just take the closest
approximation in excel's active palate to the RGB color? -Abe Don Guillett wrote: Sub rgbcolorinterior() Range("j6").Interior.Color = RGB(228, 234, 244) End Sub -- Don Guillett SalesAid Software "Zone" wrote in message oups.com... I want to apply an RGB color to a cell interior using VBA. TIA, James |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
RGB for cell interior
Since XL can only display the 56 colors in the color palette, using
Cells(1, 1).Interior.Color = RGB(63, 127, 255) will choose the "closest" color in the palette. You can change one of the colors in the palette to include your color: ActiveWorkbook.Colors(37) = RGB(63, 127, 255) You can then assign the color using the ColorIndex property: Cells(1, 1).Interior.ColorIndex = 37 In article .com, "Zone" wrote: I want to apply an RGB color to a cell interior using VBA. TIA, James |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
RGB for cell interior
Yes it does, and you cannot do what you want to do without changing one of
the standard colours to the colour combination that you want. -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Abe" wrote in message oups.com... Don, correct me if I am wrong, but doesn't that just take the closest approximation in excel's active palate to the RGB color? -Abe Don Guillett wrote: Sub rgbcolorinterior() Range("j6").Interior.Color = RGB(228, 234, 244) End Sub -- Don Guillett SalesAid Software "Zone" wrote in message oups.com... I want to apply an RGB color to a cell interior using VBA. TIA, James |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
RGB for cell interior
Many thanks, everyone. Seems like more Excel wierdness that RGB colors
can be applied directly to shapes but not to cells. I suppose this is intended to conserve memory. Tally-ho! James JE McGimpsey wrote: Since XL can only display the 56 colors in the color palette, using Cells(1, 1).Interior.Color = RGB(63, 127, 255) will choose the "closest" color in the palette. You can change one of the colors in the palette to include your color: ActiveWorkbook.Colors(37) = RGB(63, 127, 255) You can then assign the color using the ColorIndex property: Cells(1, 1).Interior.ColorIndex = 37 In article .com, "Zone" wrote: I want to apply an RGB color to a cell interior using VBA. TIA, James |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Cell interior color | Excel Discussion (Misc queries) | |||
RGB value of cell interior | Excel Programming | |||
Conditional Format with VBA - Interior Colour of cell based on value from in-cell dropdown | Excel Programming | |||
Interior Cell color | Excel Programming |