Excel Range Interior Color
This example sets the interior color for cell a1 on sheet1 to cyan.
Excel range interior color. Sub sbrangefillcolorexample3 using cell object cells 3 2 interior color rgb 0 0 250 using range object range b3 interior color rgb 0 0 250 end sub example 4. Sub setcolor worksheets sheet1 range a1 interior colorindex 8 cyan end sub support and feedback. Range a1 borders color rgb 255 255 0.
If you can t find the specific color you are looking for use the color property and the rgb function. The following example will apply all the colorindex form 1 to 55 in activesheet. Each of these colors in the palette is associated with a unique value in the colorindex.
Range a1 interior color rgb 255 0 0 explanation. Returns an interior object that represents the interior of the specified object. Format cells patterns and colors.
Returns or sets the primary color of the object as shown in the table in the remarks section. For reasons unknown aside from the index value excel also recognizes the names for colors 1 through 8 black white red green blue yellow magenta and cyan. These are the three primary colors.
Expression an expression that returns an interior object. Excel interior color macro heps you to change the interior color of an obect. Expression a variable that represents a range object.
The values in the above table were generated with help from the following macro. Sub setinteriorcolorindex range range a1 e20 interior colorindex 41 end sub you can get cell colors using excel vba here is the get cell color excel vba macro to get the cell background colors. Manually changing the interior color of worksheet cells manual setting the interior color of the active cell specifically applies to all cells in a selection that you can add to with the use of the ctrl key.