Cell Interior Color Vba
Range a1 borders color rgb 255 0 0 excel vb color.
Cell interior color vba. We can use interior color or interior colorindex properties of a rage cell to change the background colors. Set cell a1 border color to red. Press alt f11 to open vba editor.
Change background color of cell range in excel vba examples. Range a1 interior color rgb 255 0 0 example 3. If they re not all the same color color returns 0 zero.
The color of the border. The color of the tab. Then use the colorindex property of the interior object to set the background color of a cell.
The easiest way to set this property is to use the vba rgb function. To change a cells background color using vba you can use the interior colorindex property. Place three command buttons on your worksheet and add the following code lines.
Check out color reference for colorindex. The color of all four borders of a range. Function checkbackgroundcolor cell as range if cell cells count 1 then checkbackgroundcolor enter one cell exit function else checkbackgroundcolor cell interior color end if end function.
The code line below sets the background color of cell a1 to light blue. An example using the cells method. The vba color property is a more convenient way of defining the color of a cell interior border or font.