Excel Vba Interior Color
Rgb stands for red green blue which are known as three primary colors which can be combined to produce other colors.
Excel vba interior color. Place three command buttons on your worksheet and add the following code lines. Sub rgb example2 range a1 a8 interior color rgb end sub. Then use the colorindex property of the interior object to set the background color of a cell.
These are the three primary colors that can be combined to produce any other color. The excel vba color property accepts long values representing a rgb color. 2 minutes to read.
Use the interior property to return an interior object. Changing background colors in excel vba is easy. Vba excel rgb property is a color property of objects commonly used for cell color or shape color.
Interior color property excel 04 27 2019. Instead we can set the cell font color to purple. The vba color property is a more convenient way of defining the color of a cell interior border or font.
Returns or sets the primary color of the object as shown in the table in the remarks section. 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.
This sets the cell background color to yellow. When entering colors as rgb enter a value between 0 and 255 for each color code. For example purple is a mix of blue and red.