Excel Vba Interior Color
The vba color property is a more convenient way of defining the color of a cell interior border or font.
Excel vba interior color. When entering colors as rgb enter a value between 0 and 255 for each color code. This sets the cell background color to yellow. Rgb stands for red green blue which are known as three primary colors which can be combined to produce other colors.
Vba excel rgb property is a color property of objects commonly used for cell color or shape color. Col range a1 interior colorindex excel rgb color. Use the rgb function to create a color value.
Range a1 interior color rgb 255 255 0 above we ve set red 255 max value green 255 max value and blue 0 min value. Instead we can set the cell font color to purple. Use the interior property to return an interior object.
For example purple is a mix of blue and red. 2 minutes to read. The easiest way to set this property is to use the vba rgb function.
Interior color property excel 04 27 2019. Sub rgb example2 range a1 a8 interior color rgb end sub. Expression an expression that returns an interior object.
These are the three primary colors that can be combined to produce any other color. Then use the colorindex property of the interior object to set the background color of a cell. Place three command buttons on your worksheet and add the following code lines.