Interior Colorindex Vba Code
Get cell a1 colorindex.
Interior colorindex vba code. Vba excel rgb property is a color property of objects commonly used for cell color or shape color. Each workbook has it s own palette. Using color index beyond the list of 56 colors is not possible.
The color is specified as an index value into the current color palette or as one of the following xlcolorindex constants. Retrieve the interior color index of a cell using vba in microsoft excel retrieve the interior color index of a cell using vba in microsoft excel enter the following code into vba. As you can see in the image on the left this represents a variety of colors.
Set cell a1 border color to red. It is always recommended to use vba color index when statistical data are used. Function interiorcolor cellcolor as range.
With mychart chartarea interior colorindex 3 border colorindex 5 end with note. Always save the file in macro enabled excel so that created code and macro can be used multiple times. This example sets the color of the chart area interior to red and sets the border color to blue.
How the color palette works palette the arrangement in xl97 differs from previous releases in that the colors are arranged from darker to lighter colors but the color index values remain the same. Excel vba colorindex returns index values from 1 to 56 4105 and 4142. The vba colorindex property can be any value between 1 and 56 and represents a color defined within your currently selected color theme with the provided index.
Col range a1 interior colorindex excel rgb color. Interior colorindex excel returns or sets a value that represents the color of the interior. You can set the default colors using vba enumeration number 4105 or xlcolorindexautomatic.